@devries-cameron20 / t3code-1 / commits / fd8e386f7f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): the thread list shows server changes after a tab round trip (#35325)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Theo Browne committed Nov 12, 2026 at 08:27 UTC fd8e386f7f259070899553e55c99a2a49a378480
3 files changed +75 -9
apps/mobile/src/Stack.tsx
+3 -3
@@ -493,11 +493,11 @@ const RootStackConfig = createWorkspaceStackNavigator({
493 Home: createNativeStackScreen({
494 screen: WorkspaceRootScreen,
495 linking: "",
496 - listeners: {
496 + listeners: ({ navigation }) => ({
497 transitionStart: ({ data }) => recordHomeTransitionStart(data.closing),
498 - transitionEnd: ({ data }) => recordHomeTransitionEnd(data.closing),
498 + transitionEnd: ({ data }) => recordHomeTransitionEnd(data.closing, navigation.isFocused()),
499 focus: recordHomeFocus,
500 - },
500 + }),
501 options: {
502 ...pageRoute({ duoMinimize: "never", root: true }),
503 contentStyle: { backgroundColor: "transparent" },
apps/mobile/src/features/home/home-route-visibility.test.tsx
+59 -3
@@ -4,7 +4,10 @@ import { act, useLayoutEffect } from "react";
4 import { createRoot } from "react-dom/client";
5 import { expect, it, vi } from "vite-plus/test";
6
7 -import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
7 +import {
8 + NativePrimaryColumnContext,
9 + NativeWorkspaceTabActivityContext,
10 +} from "../../native/v5-workspace-context";
11
12 // The Thread in the detail column is the focused route on iPad split view.
13 vi.mock("@react-navigation/native", () => ({
@@ -12,6 +15,7 @@ vi.mock("@react-navigation/native", () => ({
15 }));
16
17 import {
18 + recordHomeFocus,
19 recordHomeTransitionEnd,
20 recordHomeTransitionStart,
21 useAtomValueWhileVisible,
@@ -54,6 +58,18 @@ function setup() {
58 ),
59 );
60 },
61 + /** A phone has no primary column: Home is the root page of its tab's slot. */
62 + showHomeInTabSlot(active: boolean) {
63 + act(() =>
64 + root.render(
65 + <RegistryContext.Provider value={registry}>
66 + <NativeWorkspaceTabActivityContext value={{ active, isActive: () => active }}>
67 + <Probe />
68 + </NativeWorkspaceTabActivityContext>
69 + </RegistryContext.Provider>,
70 + ),
71 + );
72 + },
73 [Symbol.dispose]() {
74 act(() => root.unmount());
75 registry.dispose();
@@ -71,11 +87,51 @@ it("keeps the sidebar thread list live after switching tabs beside a focused Thr
87
88 // Chats → PRs → Chats: Chats' column will-appear, then the PRs column's did-disappear.
89 act(() => {
74 - recordHomeTransitionEnd(true);
90 + recordHomeTransitionEnd(true, false);
91 recordHomeTransitionStart(false);
76 - recordHomeTransitionEnd(true);
92 + recordHomeTransitionEnd(true, false);
93 });
94 act(() => home.registry.set(shellsAtom, 2));
95
96 expect(home.latest, "new thread shells reach the sidebar list").toBe(2);
97 });
98 +
99 +// Each phone tab slot shows its own copy of the Home route. PRs keeps Home focused; Settings
100 +// is a route of its own.
101 +it.each([
102 + { tab: "PRs", homeFocusedUnderTab: true },
103 + { tab: "Settings", homeFocusedUnderTab: false },
104 +])(
105 + "keeps the phone thread list live after a round trip through $tab",
106 + ({ homeFocusedUnderTab }) => {
107 + using home = setup();
108 + recordHomeFocus();
109 + home.showHomeInTabSlot(true);
110 + act(() => home.registry.set(shellsAtom, 1));
111 + expect(home.latest).toBe(1);
112 +
113 + // To the other tab: its slot will-appear, then the Chats slot's did-disappear.
114 + act(() => {
115 + recordHomeTransitionStart(false);
116 + recordHomeTransitionEnd(true, homeFocusedUnderTab);
117 + });
118 + home.showHomeInTabSlot(false);
119 + act(() => home.registry.set(shellsAtom, 2));
120 + expect(home.latest, "the list under another tab holds its rows").toBe(1);
121 +
122 + // Back to Chats: its slot will-appear, then the other slot's did-disappear comes last.
123 + act(() => {
124 + recordHomeFocus();
125 + recordHomeTransitionStart(false);
126 + recordHomeTransitionEnd(true, true);
127 + });
128 + home.showHomeInTabSlot(true);
129 + act(() => home.registry.set(shellsAtom, 3));
130 + expect(home.latest, "a server rename reaches the list").toBe(3);
131 +
132 + // A pushed Thread takes the focus and still stops the list.
133 + act(() => recordHomeTransitionEnd(true, false));
134 + act(() => home.registry.set(shellsAtom, 4));
135 + expect(home.latest, "the list under a Thread holds its rows").toBe(3);
136 + },
137 +);
apps/mobile/src/features/home/home-route-visibility.ts
+13 -3
@@ -3,7 +3,10 @@ import { useNavigation } from "@react-navigation/native";
3 import { useContext, useRef, useSyncExternalStore } from "react";
4 import type { Atom } from "effect/reactivity";
5
6 -import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
6 +import {
7 + NativePrimaryColumnContext,
8 + NativeWorkspaceTabActivityContext,
9 +} from "../../native/v5-workspace-context";
10
11 /**
12 * Home stays mounted under a pushed Thread, and native-stack never freezes the
@@ -34,8 +37,12 @@ export function recordHomeTransitionStart(closing: boolean): void {
37 if (!closing) setHomeVisible(true);
38 }
39
37 -export function recordHomeTransitionEnd(closing: boolean): void {
38 - if (closing) setHomeVisible(false);
40 +/**
41 + * Each iOS tab slot shows its own copy of the Home route, and the slot a tab switch leaves
42 + * disappears last. So a disappear hides Home only when another route has the focus.
43 + */
44 +export function recordHomeTransitionEnd(closing: boolean, homeFocused: boolean): void {
45 + if (closing && !homeFocused) setHomeVisible(false);
46 }
47
48 /** Popping a sheet or a deep-linked route above Home has no appear event. */
@@ -46,10 +53,13 @@ export function recordHomeFocus(): void {
53 export function useHomeRouteVisible(): boolean {
54 const navigation = useNavigation();
55 const primaryColumn = useContext(NativePrimaryColumnContext);
56 + const tabActive = useContext(NativeWorkspaceTabActivityContext)?.active ?? true;
57 const visible = useSyncExternalStore(subscribeHomeVisibility, () => homeVisible);
58 // Every tab slot's primary column reports to the one Home route, so a tab
59 // switch can end on the leaving slot's disappear. Trust this column instead.
60 if (primaryColumn) return primaryColumn.presented;
61 + // The store is true for the Home route of every tab; this list shows in one of them.
62 + if (!tabActive) return false;
63 // Before Home's first navigation event: a cold deep link mounts Home under
64 // its Thread without ever showing it.
65 return visible ?? navigation.isFocused();