diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 2c3bc4c91..354a2115b 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -80,6 +80,7 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error { types.REMOTES, types.STATUS, types.BISECT_INFO, + types.STAGING, }) } else { scopeSet = set.NewFromSlice(options.Scope) diff --git a/pkg/gui/controllers/helpers/staging_helper.go b/pkg/gui/controllers/helpers/staging_helper.go index da67de9b8..75280b985 100644 --- a/pkg/gui/controllers/helpers/staging_helper.go +++ b/pkg/gui/controllers/helpers/staging_helper.go @@ -21,6 +21,13 @@ func NewStagingHelper( // NOTE: used from outside this file func (self *StagingHelper) RefreshStagingPanel(focusOpts types.OnFocusOpts) error { secondaryFocused := self.secondaryStagingFocused() + mainFocused := self.mainStagingFocused() + + // this method could be called when the staging panel is not being used, + // in which case we don't want to do anything. + if !mainFocused && !secondaryFocused { + return nil + } mainSelectedLineIdx := -1 secondarySelectedLineIdx := -1 @@ -109,3 +116,7 @@ func (self *StagingHelper) handleStagingEscape() error { func (self *StagingHelper) secondaryStagingFocused() bool { return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().StagingSecondary.GetKey() } + +func (self *StagingHelper) mainStagingFocused() bool { + return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().Staging.GetKey() +}