Skip to content

Commit c87661d

Browse files
committed
Use async refresh rather than manual OnWorker call
This is exactly what async refresh is for.
1 parent d82852a commit c87661d

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

pkg/gui/controllers/local_commits_controller.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,10 +1265,7 @@ func (self *LocalCommitsController) GetOnFocus() func(types.OnFocusOpts) {
12651265
context := self.context()
12661266
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
12671267
context.SetLimitCommits(false)
1268-
self.c.OnWorker(func(_ gocui.Task) error {
1269-
self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}})
1270-
return nil
1271-
})
1268+
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.COMMITS}})
12721269
}
12731270
}
12741271
}

pkg/gui/controllers/sub_commits_controller.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package controllers
22

33
import (
4-
"github.com/jesseduffield/gocui"
54
"github.com/jesseduffield/lazygit/pkg/commands/models"
65
"github.com/jesseduffield/lazygit/pkg/gui/context"
76
"github.com/jesseduffield/lazygit/pkg/gui/types"
@@ -67,10 +66,7 @@ func (self *SubCommitsController) GetOnFocus() func(types.OnFocusOpts) {
6766
context := self.context()
6867
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
6968
context.SetLimitCommits(false)
70-
self.c.OnWorker(func(_ gocui.Task) error {
71-
self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.SUB_COMMITS}})
72-
return nil
73-
})
69+
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.SUB_COMMITS}})
7470
}
7571
}
7672
}

0 commit comments

Comments
 (0)