fix(preview): return to pip when closing the right panel (#11102)
This commit is contained in:
1 parent
e784975bbe
commit
0882431e0f
1 file changed
+19
-8
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user