diff --git a/web/chat/typeahead-tooltip.react.js b/web/chat/typeahead-tooltip.react.js --- a/web/chat/typeahead-tooltip.react.js +++ b/web/chat/typeahead-tooltip.react.js @@ -37,6 +37,10 @@ setChosenPositionInOverlay, ] = React.useState(0); + const [frozenSuggestedUsers, setFrozenSuggestedUsers] = React.useState< + $ReadOnlyArray, + >([]); + const overlayRef = React.useRef(); React.useEffect(() => { @@ -45,13 +49,19 @@ return () => setIsVisibleForAnimation(false); }, []); + React.useEffect(() => { + if (frozenSuggestedUsers.length === 0) { + setFrozenSuggestedUsers(suggestedUsers); + } + }, [suggestedUsers, frozenSuggestedUsers.length, setFrozenSuggestedUsers]); + const actions = React.useMemo( () => getTypeaheadTooltipActions({ inputStateDraft: inputState.draft, inputStateSetDraft: inputState.setDraft, inputStateSetTextCursorPosition: inputState.setTextCursorPosition, - suggestedUsers, + suggestedUsers: frozenSuggestedUsers, textBeforeAtSymbol, usernamePrefix, }), @@ -59,7 +69,7 @@ inputState.draft, inputState.setDraft, inputState.setTextCursorPosition, - suggestedUsers, + frozenSuggestedUsers, textBeforeAtSymbol, usernamePrefix, ],