desktop: fix race condition when searching for address (#7776)

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
EvgenyandEvgeny @ SimpleX Chat authored and GitHub committed 2026-10-19 17:54:57 +01:00
1 parent fc3f3abd0e
commit ba9269a3ad
1 file changed
+3 -3
@@ -874,10 +874,10 @@ private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState
} else {
val candidate = nameSearchCandidate(it.trim())
connectNameCandidate.value = candidate
// clear the previous match immediately so the list falls back to text search during the debounce,
// instead of showing a stale filtered chat while the new search runs
searchChatFilteredBySimplexLink.value = emptySet()
if (candidate != null) {
// clear the previous match immediately so the list falls back to text search during the debounce,
// instead of showing a stale filtered chat while the new search runs
searchChatFilteredBySimplexLink.value = emptySet()
// resolve the name locally on each keystroke, debounced; collectLatest cancels the in-flight
// search when the next keystroke arrives. A bare name can be a contact or a channel, so search
// both and filter every known chat found; drop the row only when both types are already known.