[lib] fix @-mentioning in a pending GENESIS sidebar crashes app
Summary:
@-mentioning in a pending GENSIS sidebar would crash the app. This was because in useMentionTypeaheadChatSuggestions we were attempting to get the chat mention search index from the communityThreadIDForGenesisThreads with a pending thread info id. The reason this is an issue is that we build the communityThreadIDForGenesisThreads is built with resolvedThreadInfos. This meant that pending sidebar thread ids (which look like this pending/sidebar/256|145027) weren't included in the communityThreadIDForGenesisThreads object, and was returning an undefined chatSearchIndex.
The solution I've come up with is to add a check if the thread is pending and then if it is, use the resolved containing threadID of the pending sidebar since that will have the same chat mention candidates as the sidebar thread if it was resolved.
Linear task: https://linear.app/comm/issue/ENG-6640/mentioning-a-user-in-a-pending-genesis-sidebar-causes-the-app-to-crash
Test Plan:
Please see the demo video below
Here are the @ mentioning candidates for a resolved sidebar:
Here are the @ mentioning candidates for a pending sidebar:
Reviewers: atul, inka, ashoat
Reviewed By: ashoat
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D10956