Skip to content

Commit

Permalink
perf: improve mention list to make sure its will work fine in huge group
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Mar 20, 2024
1 parent 6efcb01 commit d79a62b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/web/src/components/ChatBox/ChatInputBox/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ export const ChatInputBoxInput: React.FC<ChatInputBoxInputProps> = React.memo(
>
<Mention
trigger="@"
data={users ?? []}
data={
(query) =>
(users ?? [])
.filter((u) => u.display?.includes(query))
.slice(0, 20) // max display 20 item at most
}
displayTransform={(id, display) => `@${display}`}
appendSpaceOnAdd={true}
renderSuggestion={(suggestion) => (
Expand Down

0 comments on commit d79a62b

Please sign in to comment.