Skip to content

Commit a1e79a5

Browse files
PR Batch Testerclaude
andcommitted
fix(web): files and diffs opened from a side chat actually show
A side chat has no right panel of its own, so what it opened went into panel state nothing rendered. Attachments now open in the host's panel. A turn diff opens the side chat as a full thread, since the host's diff panel only knows the host's runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent de52dbe commit a1e79a5

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@ type ChatViewProps =
866866
* terminals or global shortcuts of its own, and no nested side chats.
867867
*/
868868
embedded?: boolean;
869+
/** The host thread whose right panel shows what an embedded side chat opens. */
870+
panelOwnerRef?: ScopedThreadRef;
869871
}
870872
| {
871873
environmentId: EnvironmentId;
@@ -876,6 +878,7 @@ type ChatViewProps =
876878
routeKind: "draft";
877879
draftId: DraftId;
878880
embedded?: never;
881+
panelOwnerRef?: never;
879882
};
880883

881884
interface TerminalLaunchContext {
@@ -1612,6 +1615,7 @@ export default function ChatView(props: ChatViewProps) {
16121615
reserveTitleBarControlInset = true,
16131616
forceExpandedMobileComposer = false,
16141617
embedded = false,
1618+
panelOwnerRef,
16151619
} = props;
16161620
const canOperateThread = useEnvironmentScope(environmentId, AuthOrchestrationOperateScope);
16171621
const canOperateTerminal = useEnvironmentScope(environmentId, AuthTerminalOperateScope);
@@ -3817,12 +3821,14 @@ export default function ChatView(props: ChatViewProps) {
38173821
);
38183822
const openFileAttachment = useCallback(
38193823
(attachment: ChatFileAttachment) => {
3820-
if (activeThreadRef) {
3821-
useRightPanelStore.getState().openAttachment(activeThreadRef, attachment);
3824+
// A side chat has no panel of its own; its attachments open in the host's.
3825+
const panelRef = panelOwnerRef ?? activeThreadRef;
3826+
if (panelRef) {
3827+
useRightPanelStore.getState().openAttachment(panelRef, attachment);
38223828
return;
38233829
}
38243830
},
3825-
[activeThreadRef],
3831+
[activeThreadRef, panelOwnerRef],
38263832
);
38273833
const serverAttachmentResources = useMemo(
38283834
() =>
@@ -11094,8 +11100,16 @@ export default function ChatView(props: ChatViewProps) {
1109411100
useDiffPanelStore.getState().selectTurn(activeThreadRef, runId, filePath);
1109511101
useRightPanelStore.getState().open(activeThreadRef, "diff");
1109611102
onDiffPanelOpen?.();
11103+
// The host's diff panel only knows the host's runs, so a side chat's diff
11104+
// opens with the side chat as a full thread, where its own panel renders.
11105+
if (embedded) {
11106+
void navigate({
11107+
to: "/$environmentId/$threadId",
11108+
params: buildThreadRouteParams(activeThreadRef),
11109+
});
11110+
}
1109711111
},
11098-
[activeThreadRef, diffOpen, isServerThread, onDiffPanelOpen],
11112+
[activeThreadRef, diffOpen, embedded, isServerThread, navigate, onDiffPanelOpen],
1109911113
);
1110011114
// The revert handler is read from a ref at call-time so the callback
1110111115
// reference is fully stable and never busts TimelineRowCtx identity.
@@ -12341,6 +12355,7 @@ function SideChatPanel(props: { parentRef: ScopedThreadRef; threadId: ThreadId }
1234112355
<ComposerHandleContext value={composerRef}>
1234212356
<ChatView
1234312357
embedded
12358+
panelOwnerRef={props.parentRef}
1234412359
routeKind="server"
1234512360
environmentId={props.parentRef.environmentId}
1234612361
threadId={props.threadId}

0 commit comments

Comments
 (0)