Page MenuHomePhabricator

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

Authored by atul on May 8 2024, 6:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 2:21 AM
Unknown Object (File)
Thu, Nov 21, 2:21 AM
Unknown Object (File)
Sun, Nov 10, 11:41 AM
Unknown Object (File)
Fri, Nov 8, 7:16 PM
Unknown Object (File)
Fri, Nov 8, 7:16 PM
Unknown Object (File)
Thu, Nov 7, 11:48 AM
Unknown Object (File)
Oct 25 2024, 10:26 PM
Unknown Object (File)
Oct 22 2024, 1:15 PM
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.May 8 2024, 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.May 9 2024, 3:54 AM

address feedback before landing