From e4ec3cfca7395eea01b565b5343daf634ee0e10c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 27 Jun 2026 11:51:58 -0700 Subject: [PATCH] Resolve remaining iPad review issues --- .../files/sourceHighlightingState.test.ts | 2 +- .../home/WorkspaceConnectionStatus.test.ts | 11 ++++++ .../home/workspace-connection-status.ts | 1 + .../layout/AdaptiveWorkspaceLayout.tsx | 2 ++ .../layout/workspace-pane-divider.tsx | 4 +-- .../src/features/threads/ThreadComposer.tsx | 4 +++ .../features/threads/ThreadDetailScreen.tsx | 2 +- .../src/features/threads/ThreadFeed.tsx | 36 +++---------------- .../features/threads/ThreadRouteScreen.tsx | 17 +++++++++ 9 files changed, 43 insertions(+), 36 deletions(-) diff --git a/apps/mobile/src/features/files/sourceHighlightingState.test.ts b/apps/mobile/src/features/files/sourceHighlightingState.test.ts index 6c4c00e166..50b4eec41b 100644 --- a/apps/mobile/src/features/files/sourceHighlightingState.test.ts +++ b/apps/mobile/src/features/files/sourceHighlightingState.test.ts @@ -88,7 +88,7 @@ describe("sourceHighlightingState", () => { expect(AsyncResult.isSuccess(registry.get(atom))).toBe(true); }); firstUnmount(); - await new Promise((resolve) => setTimeout(resolve, 25)); + await new Promise((resolve) => setTimeout(resolve, 100)); const secondUnmount = registry.mount(atom); await vi.waitFor(() => { diff --git a/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts b/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts index e92d38af8b..767f0e3dd3 100644 --- a/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts +++ b/apps/mobile/src/features/home/WorkspaceConnectionStatus.test.ts @@ -56,4 +56,15 @@ describe("workspace connection status", () => { expect(shouldShowWorkspaceConnectionStatus(state)).toBe(true); expect(workspaceConnectionStatusLabel(state)).toBe("Reconnecting to Julius’s Mac mini"); }); + + it("surfaces connection errors before the generic disconnected fallback", () => { + const state = workspaceState({ + connectionError: "Could not reach Julius’s Mac mini", + hasLoadedShellSnapshot: false, + hasReadyEnvironment: false, + }); + + expect(shouldShowWorkspaceConnectionStatus(state)).toBe(true); + expect(workspaceConnectionStatusLabel(state)).toBe("Could not reach Julius’s Mac mini"); + }); }); diff --git a/apps/mobile/src/features/home/workspace-connection-status.ts b/apps/mobile/src/features/home/workspace-connection-status.ts index d523684f03..7d2c6d840d 100644 --- a/apps/mobile/src/features/home/workspace-connection-status.ts +++ b/apps/mobile/src/features/home/workspace-connection-status.ts @@ -17,5 +17,6 @@ export function workspaceConnectionStatusLabel(state: WorkspaceState): string { if (state.connectingEnvironments.length > 1) { return `Reconnecting ${state.connectingEnvironments.length} environments`; } + if (state.connectionError !== null) return state.connectionError; return "Not connected"; } diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx index 4221e290b1..644abaefd2 100644 --- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx +++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx @@ -190,9 +190,11 @@ export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode }) useHardwareKeyboardCommand("toggleSidebar", handleToggleSidebarCommand); const showAuxiliaryPane = useCallback((role: WorkspaceAuxiliaryPaneRole) => { if (role === "inspector") { + setFocusedAuxiliaryPaneRole("inspector"); setFileInspectorPreferredVisible(true); return; } + setFocusedAuxiliaryPaneRole("supplementary"); setSupplementaryPanePreferredVisible(true); }, []); const handleOpenFilesCommand = useCallback(() => { diff --git a/apps/mobile/src/features/layout/workspace-pane-divider.tsx b/apps/mobile/src/features/layout/workspace-pane-divider.tsx index c6fd1fca8e..a892ab7365 100644 --- a/apps/mobile/src/features/layout/workspace-pane-divider.tsx +++ b/apps/mobile/src/features/layout/workspace-pane-divider.tsx @@ -59,9 +59,9 @@ export function WorkspacePaneDivider(props: WorkspacePaneDividerProps) { const handleAccessibilityAction = (event: AccessibilityActionEvent) => { props.onResizeStart?.(); if (event.nativeEvent.actionName === "increment") { - props.onResizeBy(ACCESSIBILITY_RESIZE_STEP * props.resizeDirection); + props.onResizeBy(ACCESSIBILITY_RESIZE_STEP); } else if (event.nativeEvent.actionName === "decrement") { - props.onResizeBy(-ACCESSIBILITY_RESIZE_STEP * props.resizeDirection); + props.onResizeBy(-ACCESSIBILITY_RESIZE_STEP); } props.onResizeEnd?.(); }; diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx index a48a2cc6ca..4acd69e92f 100644 --- a/apps/mobile/src/features/threads/ThreadComposer.tsx +++ b/apps/mobile/src/features/threads/ThreadComposer.tsx @@ -217,6 +217,10 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer const isExpanded = isFocused; const canSend = hasContent; + useEffect(() => { + sendInFlightRef.current = false; + }, [props.selectedThread.id]); + const onPressImage = useCallback( (uri: string) => { wasExpandedBeforePreviewRef.current = isFocused; diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 9bc3e20939..15aea05dd2 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -385,7 +385,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread freeze={freeze} anchorMessageId={anchorMessageId} contentInsetEndAdjustment={contentInsetEndAdjustment} - contentTopInset={headerHeight} + contentTopInset={props.usesAutomaticContentInsets ? headerHeight : 0} contentBottomInset={estimatedOverlayHeight} contentMaxWidth={contentMaxWidth} layoutVariant={layoutVariant} diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx index 7fdcb5f3ff..745fc1770b 100644 --- a/apps/mobile/src/features/threads/ThreadFeed.tsx +++ b/apps/mobile/src/features/threads/ThreadFeed.tsx @@ -1128,8 +1128,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { const foldSettleSecondFrameRef = useRef(null); const disclosureAnchorKeyRef = useRef(null); const headerMaterialVisibleRef = useRef(false); - const listContentHeightRef = useRef(0); - const listViewportHeightRef = useRef(0); const previousLatestTurnRef = useRef(props.latestTurn); const { width: windowWidth } = useWindowDimensions(); const [viewportWidth, setViewportWidth] = useState(() => @@ -1234,37 +1232,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { }, [reportHeaderMaterialVisibility, topContentInset], ); - const reportInitialHeaderMaterialVisibility = useCallback(() => { - const topInsetContribution = props.usesAutomaticContentInsets ? topContentInset : 0; - reportHeaderMaterialVisibility( - listContentHeightRef.current - listViewportHeightRef.current + topInsetContribution > 6, - ); - }, [props.usesAutomaticContentInsets, reportHeaderMaterialVisibility, topContentInset]); - const handleViewportLayout = useCallback( - (event: LayoutChangeEvent) => { - const nextWidth = Math.round(event.nativeEvent.layout.width); - const nextHeight = Math.round(event.nativeEvent.layout.height); - setViewportWidth((current) => (Math.abs(current - nextWidth) > 1 ? nextWidth : current)); - if (Math.abs(listViewportHeightRef.current - nextHeight) > 1) { - listViewportHeightRef.current = nextHeight; - reportInitialHeaderMaterialVisibility(); - } - }, - [reportInitialHeaderMaterialVisibility], - ); - const handleContentSizeChange = useCallback( - (_contentWidth: number, contentHeight: number) => { - const nextHeight = Math.round(contentHeight); - if (Math.abs(listContentHeightRef.current - nextHeight) > 1) { - listContentHeightRef.current = nextHeight; - reportInitialHeaderMaterialVisibility(); - } - }, - [reportInitialHeaderMaterialVisibility], - ); + const handleViewportLayout = useCallback((event: LayoutChangeEvent) => { + const nextWidth = Math.round(event.nativeEvent.layout.width); + setViewportWidth((current) => (Math.abs(current - nextWidth) > 1 ? nextWidth : current)); + }, []); useEffect(() => { - listContentHeightRef.current = 0; reportHeaderMaterialVisibility(false); }, [props.threadId, reportHeaderMaterialVisibility]); @@ -1572,7 +1545,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { keyboardLiftBehavior="whenAtEnd" estimatedItemSize={180} initialScrollAtEnd - onContentSizeChange={handleContentSizeChange} onScroll={handleScroll} scrollEventThrottle={16} ListHeaderComponent={ diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index 5fc5fa39ab..e69294e9ea 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -256,6 +256,23 @@ function ThreadRouteContent( ? inspectorSelection.mode : null; + useEffect(() => { + setInspectorSelection((current) => { + if (props.renderInspector === undefined) { + if (current === null || current.mode === "route") { + return null; + } + return { ...current, routeThreadIdentity }; + } + + if (current === null || current.mode === "route") { + return { routeThreadIdentity, mode: "route" }; + } + + return { ...current, routeThreadIdentity }; + }); + }, [props.renderInspector, routeThreadIdentity]); + useFocusEffect( useCallback(() => { return () => {