Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apps/mobile/src/features/threads/useThreadListV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ function useKeySet(newlineSeparatedKeys: string): ReadonlySet<string> {

type LayoutInput = Parameters<typeof buildThreadListV2Items>[0];

/**
* The React Compiler memoizes on the values a callback reads and drops unread entries from a
* dependency list, so the version that marks an expired grace must be read to rebuild the list.
*/
function observeInbox(
threads: Parameters<typeof threadListInboxReturns.observe>[0],
_expiredGraceVersion: number,
) {
return threadListInboxReturns.observe(threads);
}

/**
* Home's and the thread sidebar's thread list. Its result is one value a screen only reads:
* built inline, the list's inputs stayed open to mutation across the screen's other hooks, so
Expand Down Expand Up @@ -62,8 +73,7 @@ export function useThreadListV2(input: {
threadListInboxReturns.getSnapshot,
);
const inbox = useMemo(
() => threadListInboxReturns.observe(workingShelfEnabled ? threads : null),
// oxlint-disable-next-line react/memo-dependencies -- the version signals an expired grace
() => observeInbox(workingShelfEnabled ? threads : null, inboxVersion),
[threads, workingShelfEnabled, inboxVersion],
);
// Up/down menu availability for every card, computed once per section per
Expand Down
Loading