diff --git a/changelog.d/2192.bugfix b/changelog.d/2192.bugfix new file mode 100644 index 0000000000..0138f3508c --- /dev/null +++ b/changelog.d/2192.bugfix @@ -0,0 +1 @@ +Mention selector gets stuck when quickly deleting the prompt. diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 2e9aeaf6e6..11d1e96a1f 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -192,7 +192,7 @@ class MessageComposerPresenter @Inject constructor( // This will trigger a search immediately when `@` is typed val mentionStartTrigger = suggestionSearchTrigger.filter { it?.text.isNullOrEmpty() } // This will start a search when the user changes the text after the `@` with a debounce to prevent too much wasted work - val mentionCompletionTrigger = suggestionSearchTrigger.filter { !it?.text.isNullOrEmpty() }.debounce(0.3.seconds) + val mentionCompletionTrigger = suggestionSearchTrigger.debounce(0.3.seconds).filter { !it?.text.isNullOrEmpty() } merge(mentionStartTrigger, mentionCompletionTrigger) .combine(room.membersStateFlow) { suggestion, roomMembersState -> memberSuggestions.clear()