Skip to content

Commit

Permalink
Fix mention selector getting stuck when quickly deleting the prompt (#…
Browse files Browse the repository at this point in the history
…2195)

* Fix mention selector getting stuck when quickly deleting the prompt
  • Loading branch information
jmartinesp authored Jan 9, 2024
1 parent afacef0 commit e8c6226
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/2192.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mention selector gets stuck when quickly deleting the prompt.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e8c6226

Please sign in to comment.