From ba9269a3add4b552a2f81d0c604f343157633fb3 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 19 Oct 2026 17:54:57 +0100 Subject: [PATCH] desktop: fix race condition when searching for address (#7776) Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> --- .../chat/simplex/common/views/chatlist/ChatListView.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt index 0615f6e5dd..52cb2b338b 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt @@ -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.