From 0f85c2b2b4085d718ba5abd2d207a4f0f5a7eff9 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 3 Jul 2026 14:25:10 +0200 Subject: [PATCH] Bounce SUB_COMMITS model updates onto the UI thread refreshSubCommitsWithLimit now loads the sub-commits on the worker and writes Model.SubCommits (and folds their authors into Model.Authors via RefreshAuthors) inside an onUIThreadUnlessRepoChanged bounce. SubCommitsMutex and AuthorsMutex are left in place: the former is shared with setSubCommits, the latter with the commits refresh's RefreshAuthors call, so both come out only once those other writers are on the UI thread too. Co-Authored-By: Claude Sonnet 5 --- pkg/gui/controllers/helpers/refresh_helper.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 4d511ed78..67b8e86f1 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -594,6 +594,8 @@ func (self *RefreshHelper) refreshSubCommitsWithLimit() error { self.c.Mutexes().SubCommitsMutex.Lock() defer self.c.Mutexes().SubCommitsMutex.Unlock() + generation := self.c.State().GetRepoGeneration() + commits, err := self.c.Git().Loaders.CommitLoader.GetCommits( git_commands.GetCommitsOptions{ Limit: self.c.Contexts().SubCommits.GetLimitCommits(), @@ -610,8 +612,11 @@ func (self *RefreshHelper) refreshSubCommitsWithLimit() error { if err != nil { return err } - self.c.Model().SubCommits = commits - self.RefreshAuthors(commits) + self.onUIThreadUnlessRepoChanged(generation, func() error { + self.c.Model().SubCommits = commits + self.RefreshAuthors(commits) + return nil + }) self.refreshView(self.c.Contexts().SubCommits) return nil