Skip to content

Commit

Permalink
Fix flicker when showing the status of a background fetch
Browse files Browse the repository at this point in the history
This was recently introduced, but it was done the wrong way.
WithWaitingStatusSync should only be called from the main thread, and it is
meant to be used for updating the bottom line while the UI is blocked. It is a
bad idea to call this from a background thread, and it results in ugly flicker
(occasionally).

Use the newly extracted WithWaitingStatusImpl instead, this is the same as
WithWaitingStatus (which is exactly what we need) but without the implicit
OnWorker, which we don't want because we are on a background thread already.
  • Loading branch information
stefanhaller committed Jan 30, 2025
1 parent e48e7a2 commit 638c9c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/gui/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
self.gui.waitForIntro.Wait()

fetch := func() error {
return self.gui.PopupHandler.WithWaitingStatusSync(self.gui.Tr.FetchingStatus, func() error {
return self.gui.helpers.AppStatus.WithWaitingStatusImpl(self.gui.Tr.FetchingStatus, func(gocui.Task) error {
return self.backgroundFetch()
})
}, nil)
}

// We want an immediate fetch at startup, and since goEvery starts by
Expand Down

0 comments on commit 638c9c5

Please sign in to comment.