HomePhabricator
Diffusion Comm 6412c3e55793

[lib] fix @-mentioning in a pending GENESIS sidebar crashes app

Description

[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

Details

Provenance
ginsuAuthored on Feb 5 2024, 1:49 PM
Reviewer
ashoat
Differential Revision
D10956: [lib] fix @-mentioning in a pending GENESIS sidebar crashes app
Parents
rCOMM7a6a2ce0c3d8: [lib][web][native] Handle invalidSessionDowngrade for identity actions
Branches
Unknown
Tags
Unknown