Harden split inspector edge cases

This commit is contained in:
Julius Marminge committed 2026-06-27 12:24:47 -07:00
1 parent bcf070aa2c
commit 43b9724418
5 files changed
+34 -15

No files matched your search

@@ -558,6 +558,8 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
rowsDecodeGeneration += 1
tokensDecodeGeneration += 1
contentView.tokensByRowId = [:]
rows = []
contentView.rows = []
hasAppliedInitialRowIndex = false
lastVisibleFileId = nil
pendingScrollFileId = nil
@@ -658,6 +660,7 @@ public final class T3ReviewDiffView: ExpoView, UIScrollViewDelegate {
contentView.invalidateVisibleViewport()
contentView.setNeedsDisplay()
applyInitialRowIndexIfNeeded()
applyPendingScrollIfNeeded()
emitVisibleFileIfNeeded()
let debugKey = "\(rows.count):\(Int(bounds.width)):\(Int(bounds.height)):\(Int(height))"
@@ -536,6 +536,22 @@ export function ThreadFilesTreeScreen() {
[projectName],
);
if (selectedThread === null || environmentId === null || threadId === null) {
if (fileInspector.supported) {
return (
<ThreadRouteScreen
onReturnToThread={handleReturnToThread}
renderInspector={renderInspector}
/>
);
}
return <LoadingScreen message="Opening files..." messagePlacement="above-spinner" />;
}
if (cwd === null) {
return <FilesUnavailable />;
}
if (fileInspector.supported) {
return (
<ThreadRouteScreen
@@ -545,14 +561,6 @@ export function ThreadFilesTreeScreen() {
);
}
if (selectedThread === null || environmentId === null || threadId === null) {
return <LoadingScreen message="Opening files..." messagePlacement="above-spinner" />;
}
if (cwd === null) {
return <FilesUnavailable />;
}
return (
<View className="flex-1 bg-sheet">
<Stack.Screen
@@ -152,10 +152,16 @@ export function AdaptiveWorkspaceLayout(props: { readonly children: ReactNode })
);
const environmentId = firstRouteParam(params.environmentId);
const threadId = firstRouteParam(params.threadId);
const selectedThreadKey =
environmentId !== null && threadId !== null
? scopedThreadKey(EnvironmentId.make(environmentId), ThreadId.make(threadId))
: null;
const selectedThreadKey = useMemo(() => {
if (environmentId === null || threadId === null) {
return null;
}
try {
return scopedThreadKey(EnvironmentId.make(environmentId), ThreadId.make(threadId));
} catch {
return null;
}
}, [environmentId, threadId]);
const activateAuxiliaryPaneRole = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
const owner = Symbol(role);
activeRoleOwner.current = owner;
@@ -451,14 +451,14 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
const handleSend = useCallback(async () => {
const threadId = props.selectedThread.id;
if (!canSend || inFlightThreadIdsRef.current.has(threadId)) return;
if (inFlightThreadIdsRef.current.has(threadId)) return;
inFlightThreadIdsRef.current.add(threadId);
try {
await onSendMessage();
} finally {
inFlightThreadIdsRef.current.delete(threadId);
}
}, [canSend, onSendMessage, props.selectedThread.id]);
}, [onSendMessage, props.selectedThread.id]);
const handleCommandSelect = useCallback(
(item: ComposerCommandItem) => {
if (!composerTrigger) return;
@@ -254,7 +254,9 @@ function ThreadRouteContent(
const inspectorMode =
inspectorSelection?.routeThreadIdentity === routeThreadIdentity
? inspectorSelection.mode
: null;
: fileInspector.supported && selectedThreadCwd !== null
? "files"
: null;
useEffect(() => {
setInspectorSelection((current) => {