Skip to content

Commit 2b98bbc

Browse files
playcationsclaude
andcommitted
fix(mobile): finished threads leave Working once the grace ends
The thread list rebuilt its Working placement only when the threads changed: the React Compiler dropped the grace version from the memo, since the callback never read it. A thread that finished stayed in Working until another update arrived, which after opening the app and syncing could be never. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 15fe283 commit 2b98bbc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/useThreadListV2.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ function useKeySet(newlineSeparatedKeys: string): ReadonlySet<string> {
2727

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

30+
/**
31+
* The React Compiler memoizes on the values a callback reads and drops unread entries from a
32+
* dependency list, so the version that marks an expired grace must be read to rebuild the list.
33+
*/
34+
function observeInbox(
35+
threads: Parameters<typeof threadListInboxReturns.observe>[0],
36+
_expiredGraceVersion: number,
37+
) {
38+
return threadListInboxReturns.observe(threads);
39+
}
40+
3041
/**
3142
* Home's and the thread sidebar's thread list. Its result is one value a screen only reads:
3243
* built inline, the list's inputs stayed open to mutation across the screen's other hooks, so
@@ -62,8 +73,7 @@ export function useThreadListV2(input: {
6273
threadListInboxReturns.getSnapshot,
6374
);
6475
const inbox = useMemo(
65-
() => threadListInboxReturns.observe(workingShelfEnabled ? threads : null),
66-
// oxlint-disable-next-line react/memo-dependencies -- the version signals an expired grace
76+
() => observeInbox(workingShelfEnabled ? threads : null, inboxVersion),
6777
[threads, workingShelfEnabled, inboxVersion],
6878
);
6979
// Up/down menu availability for every card, computed once per section per

0 commit comments

Comments
 (0)