fix(preview): return to pip when closing the right panel (#11102)

This commit is contained in:
maria authored and GitHub committed 2026-09-10 15:25:31 -03:00
1 parent e784975bbe
commit 0882431e0f
1 file changed
+19 -8
+19 -8
View File
@@ -4293,10 +4293,21 @@ export default function ChatView(props: ChatViewProps) {
supportsPullRequests,
threadDetailLoading,
]);
const closePreviewPanel = useCallback(() => {
if (activeThreadRef) {
if (activeRightPanelSurface?.kind === "preview" && activeRightPanelSurface.resourceId) {
usePreviewMiniPlayerStore
.getState()
.open(activeThreadRef, activeRightPanelSurface.resourceId);
}
setMaximizedRightPanelThreadKey(null);
useRightPanelStore.getState().close(activeThreadRef);
}
}, [activeRightPanelSurface, activeThreadRef]);
const togglePreviewPanel = useCallback(() => {
if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;
if (previewPanelOpen) {
useRightPanelStore.getState().close(activeThreadRef);
closePreviewPanel();
return;
}
const activeTabId = activePreviewState.activeTabId;
@@ -4305,13 +4316,13 @@ export default function ChatView(props: ChatViewProps) {
} else {
createBrowserSurface();
}
}, [activePreviewState.activeTabId, activeThreadRef, createBrowserSurface, previewPanelOpen]);
const closePreviewPanel = useCallback(() => {
if (activeThreadRef) {
setMaximizedRightPanelThreadKey(null);
useRightPanelStore.getState().close(activeThreadRef);
}
}, [activeThreadRef]);
}, [
activePreviewState.activeTabId,
activeThreadRef,
closePreviewPanel,
createBrowserSurface,
previewPanelOpen,
]);
const addTerminalSurface = useCallback(() => {
if (!activeThreadRef || !activeThreadId || !activeProject) return;
const cwd = gitCwd ?? activeProject.workspaceRoot;