HomePhabricator
Diffusion Comm 7e09588162a4

[lib] Pull `useCommunityRootMembersToRole` out of `useThreadSearchIndex`

Tags
None
Referenced Files
F1900645: d0577f.png
May 29 2024, 6:55 PM
File Not Attached
F1900642: 33f8e2.png
May 29 2024, 6:55 PM
File Not Attached
Subscribers
None

Description

[lib] Pull useCommunityRootMembersToRole out of useThreadSearchIndex

Summary: We want to use this logic in useThreadsWithPermission as well so it makes sense to pull it out as a hook instead of copy/pasting code. Especially since the code for creating nested dictionary isn't the easiest to read.

Test Plan:
Will add log statements to useThreadSearchIndex to make sure communityRootMemebersToRole gets computed as before.

Will also set breakpoints to check structure of communityRootMembersToRole to make sure it's as expected.


BEFORE (checking constructed communityRootMembersToRole within useSearchIndex with breakpoint):

33f8e2.png (846×804 px, 144 KB)

AFTER (checking return value of useCommunityRootMembersToRole):

d0577f.png (604×726 px, 60 KB)

Note that I wasn't able to get breakpoints to hit in AFTER case for some reason, but I console.logged and made sure that the structure of object was the same.

Reviewers: ashoat, ginsu, tomek, varun

Reviewed By: tomek

Differential Revision: https://phab.comm.dev/D12145

Details

Provenance
atulAuthored on May 29 2024, 6:07 PM
Reviewer
tomek
Differential Revision
D12145: [lib] Pull `useCommunityRootMembersToRole` out of `useThreadSearchIndex`
Parents
rCOMM24e5a7762884: [native] Only show CommunityDrawerItem for communities
Branches
Unknown
Tags
Unknown