From 12757e2723c830d6831913892bb2cc5cde785873 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 7 Jul 2026 10:20:14 +0200 Subject: [PATCH] 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. --- pkg/gui/controllers/helpers/suggestions_helper.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/gui/controllers/helpers/suggestions_helper.go b/pkg/gui/controllers/helpers/suggestions_helper.go index d26f96f1c..8a5916816 100644 --- a/pkg/gui/controllers/helpers/suggestions_helper.go +++ b/pkg/gui/controllers/helpers/suggestions_helper.go @@ -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 })