The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 04:15 UTC
fix(mobile): reopening the app no longer shows a "No terminal output" alert (#20262)
Co-authored-by: PR Batch Tester <agent@local.test> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
shivam committed
Oct 19, 2026 at 00:46 UTC
6976b51056dc9b7412fbcbb72f25479b03179703
1 file changed
+11
-6
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+11
-6
@@ -292,8 +292,16 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
292
const isEnvironmentReady = environment.presentation?.connection.phase === "connected";
293
const requestedTerminalId = firstRouteParam(params.terminalId);
294
const terminalId = requestedTerminalId ?? DEFAULT_TERMINAL_ID;
295
+ // The native view treats any new positive value as a capture, including the first value a
296
+ // freshly created view receives after a reconnect or remount. Only pass a value while a
297
+ // capture is pending, and keep the sequence increasing so the next request always differs.
298
+ const captureSequenceRef = useRef(0);
299
const [captureRequest, setCaptureRequest] = useState(0);
300
const [capturedOutput, setCapturedOutput] = useState<string | null>(null);
301
+ const requestCapture = () => {
302
+ captureSequenceRef.current += 1;
303
+ setCaptureRequest(captureSequenceRef.current);
304
+ };
305
const {
306
isReady: hasResolvedFontPreference,
307
appearance,
@@ -1271,6 +1279,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1279
keyboardFocusRequest={keyboardFocusRequest}
1280
captureRequest={captureRequest}
1281
onCapture={(text) => {
1282
+ setCaptureRequest(0);
1283
if (text.trim()) setCapturedOutput(text);
1284
else
1285
Dialog.alert("No terminal output", "There is no visible output to attach.");
@@ -1286,11 +1295,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1295
{Platform.OS === "android" && !keyboardState.isVisible ? (
1296
<View className="min-h-14 flex-row items-center gap-2 bg-card-alt px-2">
1297
{selectedThread && hasNativeTerminalSurface() ? (
1289
- <Button
1290
- label="Attach output"
1291
- tone="text"
1292
- onPress={() => setCaptureRequest((value) => value + 1)}
1293
- />
1298
+ <Button label="Attach output" tone="text" onPress={requestCapture} />
1299
) : null}
1300
<View className="flex-1" />
1301
<IconButton
@@ -1305,7 +1310,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
1310
accessibilityRole="button"
1311
onPress={() => {
1312
KeyboardController.dismiss();
1308
- setCaptureRequest((value) => value + 1);
1313
+ requestCapture();
1314
}}
1315
className="px-4 py-2"
1316
>