From 80208bc2c4a413e1013021022364345aca71550e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 27 Jun 2026 12:44:54 -0700 Subject: [PATCH] Stabilize inspector pane state --- .../t3-review-diff/ios/T3ReviewDiffView.swift | 2 +- .../features/files/ThreadFilesRouteScreen.tsx | 4 ++-- .../features/threads/ThreadRouteScreen.tsx | 23 ++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift b/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift index a0018e54fb..387ca365e3 100644 --- a/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift +++ b/apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift @@ -561,12 +561,12 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate { rows = [] contentView.rows = [] hasAppliedInitialRowIndex = false - lastVisibleFileId = nil pendingScrollFileId = nil isProgrammaticScrollActive = false scrollView.setContentOffset(.zero, animated: false) updateContentMetrics() updateViewportFrame() + lastVisibleFileId = nil applyInitialRowIndexIfNeeded() } diff --git a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx index 639b6aa426..e4b9ac906a 100644 --- a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx +++ b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx @@ -537,10 +537,10 @@ export function ThreadFilesTreeScreen() { [projectName], ); useEffect(() => { - if (fileInspector.supported) { + if (fileInspector.supported && cwd !== null) { showAuxiliaryPane("inspector"); } - }, [fileInspector.supported, showAuxiliaryPane]); + }, [cwd, fileInspector.supported, showAuxiliaryPane]); if (selectedThread === null || environmentId === null || threadId === null) { if (fileInspector.supported) { diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index 8c1952701a..2ab916f78b 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -220,7 +220,7 @@ function ThreadRouteContent( readonly selectedThreadDetailState: ReturnType; }, ) { - const { fileInspector, layout, showAuxiliaryPane, toggleAuxiliaryPane } = + const { fileInspector, layout, panes, showAuxiliaryPane, toggleAuxiliaryPane } = useAdaptiveWorkspaceLayout(); const { connectionState } = useRemoteConnectionStatus(); const { onReconnectEnvironment } = useRemoteConnections(); @@ -261,6 +261,22 @@ function ThreadRouteContent( } return null; })(); + useEffect(() => { + if ( + fileInspector.supported && + selectedThreadCwd === null && + inspectorMode === null && + panes.auxiliaryPaneVisible + ) { + toggleAuxiliaryPane(); + } + }, [ + fileInspector.supported, + inspectorMode, + panes.auxiliaryPaneVisible, + selectedThreadCwd, + toggleAuxiliaryPane, + ]); useEffect(() => { setInspectorSelection((current) => { @@ -451,6 +467,7 @@ function ThreadRouteContent( ) : null, [handleSelectInspectorFile, selectedThread, selectedThreadCwd, selectedThreadProject?.title], ); + const RouteInspector = useCallback(() => props.renderInspector?.(0), [props.renderInspector]); const renderInspectorStack = useCallback( () => inspectorMode === null ? null : ( @@ -458,10 +475,10 @@ function ThreadRouteContent( Files={FilesInspector} Git={GitInspector} mode={inspectorMode} - Route={props.renderInspector ? () => props.renderInspector?.(0) : undefined} + Route={props.renderInspector ? RouteInspector : undefined} /> ), - [FilesInspector, GitInspector, inspectorMode, props.renderInspector], + [FilesInspector, GitInspector, RouteInspector, inspectorMode, props.renderInspector], ); const activeInspectorRenderer = inspectorMode === null ? undefined : renderInspectorStack;