The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): a Settings link sent to the running app opens the Settings tab (#36262)
Julius Marminge committed
Nov 13, 2026 at 11:21 UTC
9efd960925f0899c0a6d045d128557c5d82818e8
3 files changed
+70
-10
apps/mobile/src/App.tsx
+14
-9
@@ -83,7 +83,10 @@ import {
83
splashCanHide,
84
useLaunchSplashHomeRowsPending,
85
} from "./features/home/home-launch-splash";
86
-import { restoreSettingsLinkState } from "./features/settings/settings-navigation";
86
+import {
87
+ restoreSettingsLinkState,
88
+ settingsLinkAction,
89
+} from "./features/settings/settings-navigation";
90
import {
91
hydrateWorkspaceSelections,
92
launchWorkspaceURL,
@@ -143,14 +146,16 @@ const appLinking = {
146
getActionFromState: (
147
state: Parameters<typeof getActionFromState>[0],
148
options: Parameters<typeof getActionFromState>[1],
146
- ): ReturnType<typeof getActionFromState> =>
147
- // Our router handles the selection; React Navigation's type only lists its own actions.
148
- (workspaceDetailLinkAction(state) as ReturnType<typeof getActionFromState>) ??
149
- pairingFormLinkAction(
150
- state,
151
- rootNavigationRef.isReady() ? rootNavigationRef.getRootState() : undefined,
152
- ) ??
153
- getActionFromState(state, options),
149
+ ): ReturnType<typeof getActionFromState> => {
150
+ const current = rootNavigationRef.isReady() ? rootNavigationRef.getRootState() : undefined;
151
+ return (
152
+ // Our router handles the selection; React Navigation's type only lists its own actions.
153
+ (workspaceDetailLinkAction(state) as ReturnType<typeof getActionFromState>) ??
154
+ pairingFormLinkAction(state, current) ??
155
+ settingsLinkAction(state, current) ??
156
+ getActionFromState(state, options)
157
+ );
158
+ },
159
getStateFromPath: getAppStateFromPath,
160
};
161
apps/mobile/src/features/layout/workspace/workspace-tab-navigation.test.ts
+38
-1
@@ -1,6 +1,7 @@
1
+import * as NodeModule from "node:module";
2
import { describe, expect, it } from "vite-plus/test";
3
3
-import { restoreSettingsLinkState } from "../../settings/settings-navigation";
4
+import { restoreSettingsLinkState, settingsLinkAction } from "../../settings/settings-navigation";
5
import {
6
workspaceSelectionsIn,
7
workspaceTabColumns,
@@ -19,6 +20,17 @@ const pullRequest = {
20
params: { environmentId: "env", projectId: "project", repository: "o/r", number: 7 },
21
};
22
const settings = { key: "settings", name: "Settings" };
23
+const requireFromNative = NodeModule.createRequire(
24
+ NodeModule.createRequire(import.meta.url).resolve("@react-navigation/native/package.json"),
25
+);
26
+const { getStateFromPath } = requireFromNative("@react-navigation/core") as {
27
+ readonly getStateFromPath: typeof import("@react-navigation/native").getStateFromPath;
28
+};
29
+const { StackRouter } = NodeModule.createRequire(
30
+ requireFromNative.resolve("@react-navigation/core/package.json"),
31
+)("@react-navigation/routers") as {
32
+ readonly StackRouter: typeof import("@react-navigation/native").StackRouter;
33
+};
34
const available = { thread: () => true, pullRequest: () => true };
35
const names = (state: { routes: readonly { name: string }[] }) =>
36
state.routes.map((route) => route.name);
@@ -218,6 +230,31 @@ describe("Settings links", () => {
230
expect(restoreSettingsLinkState(bare, undefined)).toBe(bare);
231
});
232
233
+ it("opens a link sent to the running app on the Settings tab, as its button does", () => {
234
+ const screens = {
235
+ Home: "",
236
+ Settings: "settings",
237
+ SettingsAbout: "settings/about",
238
+ SettingsAppearance: "settings/appearance",
239
+ };
240
+ const router = StackRouter({});
241
+ const options = { routeNames: Object.keys(screens), routeParamList: {}, routeGetIdList: {} };
242
+ const open = router.getRehydratedState(
243
+ { index: 2, routes: [{ name: "Home" }, { name: "Settings" }, { name: "SettingsAbout" }] },
244
+ options,
245
+ );
246
+ const follow = (path: string) => {
247
+ const link = getStateFromPath(path, { initialRouteName: "Home", screens })!;
248
+ const action = settingsLinkAction(link, open)!;
249
+ return router.getStateForAction(open, action, options)!;
250
+ };
251
+
252
+ expect(names(follow("settings"))).toEqual(["Home", "Settings"]);
253
+ const appearance = follow("settings/appearance");
254
+ expect(names(appearance)).toEqual(["Home", "Settings", "SettingsAppearance"]);
255
+ expect(appearance.routes[1]!.key).toBe(open.routes[1]!.key);
256
+ });
257
+
258
it("opens the sign-in link as a modal over the workspace", () => {
259
const state = { routes: [{ name: "Home" }, { name: "SettingsAuth" }] };
260
expect(restoreSettingsLinkState(state, "SettingsAppearance")).toBe(state);
apps/mobile/src/features/settings/settings-navigation.ts
+18
@@ -91,6 +91,24 @@ export function settingsNavigationState<State extends { readonly routes: readonl
91
return { ...state, index: routes.length - 1, routes };
92
}
93
94
+/**
95
+ * A Settings link opened while the app runs resets the root stack the way the Settings tab
96
+ * does. React Navigation's default action pushes the linked route over whatever is open.
97
+ */
98
+export function settingsLinkAction(
99
+ link: PartialState<NavigationState>,
100
+ current: NavigationState | undefined,
101
+) {
102
+ const top = link.routes.at(-1);
103
+ if (!current || !top || top.state || !isSettingsRoute(top.name)) return undefined;
104
+ const page = top.name === "Settings" ? undefined : (top.name as SettingsPageName);
105
+ return {
106
+ type: "RESET" as const,
107
+ payload: settingsNavigationState(current, page, top.params),
108
+ target: current.key,
109
+ };
110
+}
111
+
112
/** Opens one Settings page in the Settings tab, from anywhere outside it. */
113
export function openSettings<Name extends SettingsPageName>(
114
navigation: RootStackNavigation,