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 22, 15:45 UTC
refactor(mobile): thread inspector mode is derived, not synced (#25682)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 26, 2026 at 17:37 UTC
a2398c2ce33c4b964b4d9814644ac6b83521da60
1 file changed
+14
-38
apps/mobile/src/features/threads/ThreadRouteScreen.tsx
+14
-38
@@ -111,11 +111,6 @@ import {
111
import type { ThreadInspectorTarget } from "./thread-inspector-navigation";
112
import { useSelectWorkspaceDetail } from "../workspace/useSelectWorkspaceDetail";
113
114
-interface ThreadInspectorSelection {
115
- readonly routeThreadIdentity: string | null;
116
- readonly mode: ThreadInspectorMode;
117
-}
118
-
114
function InspectorPaneRoleActivation() {
115
useAdaptiveWorkspacePaneRole("inspector");
116
return null;
@@ -435,19 +430,21 @@ function ThreadRouteContent(
430
const threadId = firstRouteParam(params.threadId);
431
const routeThreadIdentity =
432
environmentIdRaw !== null && threadId !== null ? `${environmentIdRaw}:${threadId}` : null;
438
- const [inspectorSelection, setInspectorSelection] = useState<ThreadInspectorSelection | null>(
439
- () => (props.renderInspector ? { routeThreadIdentity, mode: "route" } : null),
440
- );
433
+ // The chosen mode survives thread switches; "route" only applies while the route
434
+ // supplies an inspector, which is also the default whenever it does.
435
+ const [chosenInspectorMode, setChosenInspectorMode] = useState<ThreadInspectorMode | null>(null);
436
const previewTarget = props.inspectorPresentation ? undefined : params.inspector;
437
const inspectorMode = (() => {
438
if (previewTarget) return "preview";
444
- if (inspectorSelection?.routeThreadIdentity === routeThreadIdentity) {
445
- if (inspectorSelection.mode === "files" && selectedThreadCwd === null) {
446
- return null;
447
- }
448
- return inspectorSelection.mode;
449
- }
450
- return null;
439
+ const mode =
440
+ props.renderInspector === undefined
441
+ ? chosenInspectorMode === "route"
442
+ ? null
443
+ : chosenInspectorMode
444
+ : chosenInspectorMode === null || chosenInspectorMode === "route"
445
+ ? "route"
446
+ : chosenInspectorMode;
447
+ return mode === "files" && selectedThreadCwd === null ? null : mode;
448
})();
449
useEffect(() => {
450
if (
@@ -468,24 +465,6 @@ function ThreadRouteContent(
465
toggleAuxiliaryPane,
466
]);
467
471
- useEffect(() => {
472
- // oxlint-disable-next-line react/set-state-in-effect -- Inspector selection follows route ownership but keeps an inspector the user opened.
473
- setInspectorSelection((current) => {
474
- if (props.renderInspector === undefined) {
475
- if (current === null || current.mode === "route") {
476
- return null;
477
- }
478
- return { ...current, routeThreadIdentity };
479
- }
480
-
481
- if (current === null || current.mode === "route") {
482
- return { routeThreadIdentity, mode: "route" };
483
- }
484
-
485
- return { ...current, routeThreadIdentity };
486
- });
487
- }, [props.renderInspector, routeThreadIdentity]);
488
-
468
const revealPreview = useEffectEvent(() => showAuxiliaryPane("inspector"));
469
useEffect(() => {
470
if (previewTarget) revealPreview();
@@ -552,7 +531,7 @@ function ThreadRouteContent(
531
return;
532
}
533
navigation.setParams({ inspector: undefined });
555
- setInspectorSelection({ routeThreadIdentity, mode: "git" });
534
+ setChosenInspectorMode("git");
535
showAuxiliaryPane("inspector");
536
};
537
const handleOpenFilesInspector = () => {
@@ -567,10 +546,7 @@ function ThreadRouteContent(
546
return;
547
}
548
navigation.setParams({ inspector: undefined });
570
- setInspectorSelection({
571
- routeThreadIdentity,
572
- mode: props.renderInspector === undefined ? "files" : "route",
573
- });
549
+ setChosenInspectorMode(props.renderInspector === undefined ? "files" : "route");
550
showAuxiliaryPane("inspector");
551
};
552
const handleToggleInspector = () => {