The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): a pasted pairing link fills both Address and Code (#28635)
Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Padias committed
Nov 16, 2026 at 23:27 UTC
f9db865403ebab2a9d252c8b1532aa76b52264c6
2 files changed
+59
-2
apps/mobile/src/features/connection/ConnectionsNewRouteScreen.test.tsx
+52
-1
@@ -47,7 +47,21 @@ vi.mock("../../components/ui/Dialog", () => ({ alert: vi.fn() }));
47
vi.mock("../../components/ui/ScreenScrollView", () => ({ ScreenScrollView: Children }));
48
vi.mock("../../components/ui/AppText", () => ({
49
AppText: ({ children }: { children?: ReactNode }) => <span>{children}</span>,
50
- AppTextInput: () => null,
50
+ AppTextInput: ({
51
+ accessibilityLabel,
52
+ value,
53
+ onChangeText,
54
+ }: {
55
+ accessibilityLabel: string;
56
+ value: string;
57
+ onChangeText: (value: string) => void;
58
+ }) => (
59
+ <input
60
+ aria-label={accessibilityLabel}
61
+ value={value}
62
+ onChange={(event) => onChangeText(event.currentTarget.value)}
63
+ />
64
+ ),
65
}));
66
vi.mock("../../components/ui/FrostedCutout", () => ({ FrostedCutout: () => null }));
67
vi.mock("../../components/ui/AppSymbol", () => ({ SymbolView: () => null }));
@@ -104,3 +118,40 @@ it("does not show another feature's error as a pairing failure", () => {
118
// Leaving the form must not wipe an error that belongs to another screen.
119
expect(harness.pendingConnectionError).toBe("Could not send the message.");
120
});
121
+
122
+it("splits a pasted pairing link and preserves the code during address edits", () => {
123
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
124
+ vi.stubGlobal("__DEV__", false);
125
+ harness.pendingConnectionError = null;
126
+ const container = document.createElement("div");
127
+ const root = createRoot(container);
128
+
129
+ try {
130
+ act(() => root.render(<ConnectionsNewRouteScreen route={{ params: undefined }} />));
131
+ const address = container.querySelector<HTMLInputElement>('input[aria-label="Address"]')!;
132
+ const code = container.querySelector<HTMLInputElement>('input[aria-label="Code"]')!;
133
+ const enter = (input: HTMLInputElement, value: string) => {
134
+ act(() => {
135
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(
136
+ input,
137
+ value,
138
+ );
139
+ input.dispatchEvent(new Event("input", { bubbles: true }));
140
+ });
141
+ };
142
+
143
+ enter(code, "manual-code");
144
+ enter(address, " http://100.82.53.91:3773/pair#token=test-pairing-code\n");
145
+ expect(address.value).toBe("http://100.82.53.91:3773");
146
+ expect(code.value).toBe("test-pairing-code");
147
+
148
+ enter(code, "replacement-code");
149
+ for (const value of ["", "100.82.53.92:3773", "http://100.82.53.92:3773/"]) {
150
+ enter(address, value);
151
+ expect(address.value).toBe(value);
152
+ expect(code.value).toBe("replacement-code");
153
+ }
154
+ } finally {
155
+ act(() => root.unmount());
156
+ }
157
+});
apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+7
-1
@@ -96,7 +96,13 @@ function PairingForm({
96
};
97
98
const handleHostChange = (value: string) => {
99
- setHostInput(value);
99
+ const pairing = parsePairingUrl(value);
100
+ if (pairing.code) {
101
+ setHostInput(pairing.host);
102
+ setCodeInput(pairing.code);
103
+ } else {
104
+ setHostInput(value);
105
+ }
106
clearError();
107
};
108