Page MenuHomePhabricator

[lib] Introduce `useThreadsInChatList` and consume in `useFilteredChildThreads`
ClosedPublic

Authored by atul on Wed, May 8, 6:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 18, 3:15 AM
Unknown Object (File)
Fri, May 17, 2:59 AM
Unknown Object (File)
Thu, May 16, 3:44 PM
Unknown Object (File)
Wed, May 15, 10:07 AM
Unknown Object (File)
Tue, May 14, 7:43 PM
Unknown Object (File)
Mon, May 13, 4:10 PM
Unknown Object (File)
Fri, May 10, 8:46 AM
Unknown Object (File)
Fri, May 10, 7:51 AM
Subscribers
None

Details

Summary

We want to replace usages of threadInChatList with the useThreadInChatList hook. However, similar to what we ran into with D11924, there are situations where we need to do the check on a list of ThreadInfos instead of a single one. We can't use the useThreadInChatList hook within a for-loop or .filter() block, so we need to introduce a new hook which handles the iteration "inside." Thankfully, we can consume useThreadsWithPermission within useThreadsInChatList so we can reuse that existing logic.


Depends on D11925

Test Plan

flow and close reading

Add log statements to useFilteredChildThreads and ensure return value of threadInChatList and useThreadsInChatList are identical.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Wed, May 8, 6:42 PM
atul added inline comments.
lib/hooks/child-threads.js
66–86 ↗(On Diff #39957)

Focused on getting this correct, will do another pass to see if this logic can be simplified

lib/hooks/child-threads.js
66–68 ↗(On Diff #39957)

Right off the bat this should be memoized, will update diff

tomek added inline comments.
lib/hooks/child-threads.js
66 ↗(On Diff #39957)

This name might be a bit confusing

This revision is now accepted and ready to land.Thu, May 9, 3:54 AM

address feedback before landing