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.
Details
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):
AFTER (checking return value of useCommunityRootMembersToRole):
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.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- master
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
lib/shared/thread-utils.js | ||
---|---|---|
158–162 | Would appreciate advice on if this is the right way to type this. Before creating this type, flow said the return value of useCommunityRootMembersToRole was lodash.Dictionary<lodash.Dictionary<RoleInfo | null>> Did RoleInfo | null since it seemed narrower than ?RoleInfo since undefined isn't possible? Not sure if that was the right call, so open to reverting. |