Details
Test if tooltip:
- contains chat names
- doesn't contain chat in which we currently are
- changes its content depending on text prefix
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
web/chat/chat-input-bar.react.js | ||
---|---|---|
641–676 | Does it make sense to merge these two together? Something like const suggestions = React.useMemo(() => { if (!typeaheadMatchedStrings) { return []; } const suggestedUsers = getMentionTypeaheadUserSuggestions( userSearchIndex, props.inputState.typeaheadState.frozenUserMentionsCandidates, viewerID, typeaheadMatchedStrings.textPrefix, ); const suggestedChats = getMentionTypeaheadChatSuggestions( chatMentionSearchIndex, props.inputState.typeaheadState.frozenChatMentionsCandidates, typeaheadMatchedStrings.textPrefix, ); return [...suggestedUsers, ...suggestedChats]; }, [ typeaheadMatchedStrings, userSearchIndex, props.inputState.typeaheadState.frozenUserMentionsCandidates, viewerID, chatMentionSearchIndex, ]); |
Makes sense to me, just one comment in line regarding consolidating three similar useMemo blocks into one, but feel free to disagree if it doesn't make sense
web/chat/chat-input-bar.react.js | ||
---|---|---|
641–676 | Yes, my motivation to split this code into three useMemos was that if userSearchIndex changes and chatMentionSearchIndex not, then we would recalculate userSuggestions only, but the only time userSearchIndex and chatMentionSearchIndex would change is when user switches the focused chat, so my intuition was def wrong. |
web/input/input-state-container.react.js | ||
---|---|---|
178–179 ↗ | (On Diff #30622) | frozenChatMentionsCandidates is an object, because it's faster to get thread info from threadID in getMentionTypeaheadChatSuggestions. frozenUserMentionsCandidates is an array, because we handle user mentions differently in getMentionTypeaheadUserSuggestions |