mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-09 09:22:48 +03:00
Change Refresh to not return an error
Refresh is one of those functions that shouldn't require error handling (similar to triggering a redraw of the UI, see https://github.com/jesseduffield/lazygit/issues/3887). As far as I see, the only reason why Refresh can currently return an error is that the Then function returns one. The actual refresh errors, e.g. from the git calls that are made to fetch data, are already logged and swallowed. Most of the Then functions do only UI stuff such as selecting a list item, and always return nil; there's only one that can return an error (updating the rebase todo file in LocalCommitsController.startInteractiveRebaseWithEdit); it's not a critical error if this fails, it is only used for setting rebase todo items to "edit" when you start an interactive rebase by pressing 'e' on a range selection of commits. We simply log this error instead of returning it.
This commit is contained in:
@@ -349,13 +349,8 @@ func (gui *Gui) onNewRepo(startArgs appTypes.StartArgs, contextKey types.Context
|
||||
}
|
||||
|
||||
gui.c.Log.Info("Receiving focus - refreshing")
|
||||
refreshErr := gui.helpers.Refresh.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
if reloadErr != nil {
|
||||
// An error from reloading the config is the more important one
|
||||
// to report to the user
|
||||
return reloadErr
|
||||
}
|
||||
return refreshErr
|
||||
gui.helpers.Refresh.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
return reloadErr
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -693,7 +688,7 @@ func NewGui(
|
||||
func(ctx goContext.Context, opts types.CreatePopupPanelOpts) {
|
||||
gui.helpers.Confirmation.CreatePopupPanel(ctx, opts)
|
||||
},
|
||||
func() error { return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) },
|
||||
func() error { gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); return nil },
|
||||
func() { gui.State.ContextMgr.Pop() },
|
||||
func() types.Context { return gui.State.ContextMgr.Current() },
|
||||
gui.createMenu,
|
||||
@@ -932,9 +927,7 @@ func (gui *Gui) runSubprocessWithSuspenseAndRefresh(subprocess *oscommands.CmdOb
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); err != nil {
|
||||
return err
|
||||
}
|
||||
gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -996,9 +989,7 @@ func (gui *Gui) loadNewRepo() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}); err != nil {
|
||||
return err
|
||||
}
|
||||
gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
|
||||
if err := gui.os.UpdateWindowTitle(); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user