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 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-07-03 14:25:10 +02:00
parent 559b4bf298
commit 0f85c2b2b4

View file

@ -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