Skip to content
TypeScript

fix(mobile): finished threads leave Working once the grace ends (#28169)

Shawnbe58795d37a6
diff --git a/apps/mobile/src/features/threads/useThreadListV2.ts b/apps/mobile/src/features/threads/useThreadListV2.ts
index 2a6f3504e2f..1a0c67062fe 100644
--- a/apps/mobile/src/features/threads/useThreadListV2.ts
+++ b/apps/mobile/src/features/threads/useThreadListV2.ts
@@ -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
@@ -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