diff --git a/lib/components/chat-mention-provider.react.js b/lib/components/chat-mention-provider.react.js --- a/lib/components/chat-mention-provider.react.js +++ b/lib/components/chat-mention-provider.react.js @@ -25,7 +25,7 @@ export type ChatMentionContextType = { +getChatMentionSearchIndex: ( threadInfo: ThreadInfo, - ) => SentencePrefixSearchIndex, + ) => ?SentencePrefixSearchIndex, +communityThreadIDForGenesisThreads: { +[id: string]: string }, +chatMentionCandidatesObj: ChatMentionCandidatesObj, }; diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js --- a/lib/shared/mention-utils.js +++ b/lib/shared/mention-utils.js @@ -133,7 +133,7 @@ } function useMentionTypeaheadChatSuggestions( - chatSearchIndex: SentencePrefixSearchIndex, + chatSearchIndex: ?SentencePrefixSearchIndex, chatMentionCandidates: ChatMentionCandidates, typeaheadMatchedStrings: ?TypeaheadMatchedStrings, ): $ReadOnlyArray { @@ -142,7 +142,11 @@ return React.useMemo(() => { const result = []; - if (chatNamePrefix === undefined || chatNamePrefix === null) { + if ( + chatNamePrefix === undefined || + chatNamePrefix === null || + !chatSearchIndex + ) { return result; }