mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Swap the file-path suggestions trie on the UI thread
GetFilePathSuggestionsFunc builds the trie on a worker (the slow AllRepoFiles walk) and then assigned Model().FilesTrie and refreshed the suggestions panel from there, racing the UI thread that reads the trie. Keep the build on the worker but bounce just the model assignment and the refresh through OnUIThread.
This commit is contained in:
parent
6cd93de5b9
commit
12757e2723
|
|
@ -137,10 +137,12 @@ func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*type
|
|||
trie.Insert(patricia.Prefix(file), file)
|
||||
}
|
||||
|
||||
// cache the trie for future use
|
||||
self.c.Model().FilesTrie = trie
|
||||
|
||||
self.c.Contexts().Suggestions.RefreshSuggestions()
|
||||
self.c.OnUIThread(func() error {
|
||||
// cache the trie for future use
|
||||
self.c.Model().FilesTrie = trie
|
||||
self.c.Contexts().Suggestions.RefreshSuggestions()
|
||||
return nil
|
||||
})
|
||||
|
||||
return err
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue