Fix mention selector getting stuck when quickly deleting the prompt (#2195)

* Fix mention selector getting stuck when quickly deleting the prompt
This commit is contained in:
Jorge Martin Espinosa
2024-01-09 12:07:10 +01:00
committed by GitHub
parent 3954612a72
commit 7008b403c0
2 changed files with 2 additions and 1 deletions

1
changelog.d/2192.bugfix Normal file
View File

@@ -0,0 +1 @@
Mention selector gets stuck when quickly deleting the prompt.

View File

@@ -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()