Resolve remaining iPad review issues
This commit is contained in:
1 parent
75f0e90c03
commit
e4ec3cfca7
9 files changed
+43
-36
No files matched your search
@@ -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(() => {
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
@@ -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";
|
||||
}
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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?.();
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -1128,8 +1128,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
|
||||
const foldSettleSecondFrameRef = useRef<number | null>(null);
|
||||
const disclosureAnchorKeyRef = useRef<string | null>(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={
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in new issue
Block a user