authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-09-10 15:25:31-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-10 15:25:31-03:00
log0882431e0fc0fabe950743dd44b674a07a584bc9
tree266cd86574df3aaab167083849bb9a7d51be7a00
parente784975bbec7c54ed75fc6da3d4ffd4038fae041
signature Signed by PGP key B5690EEEBB952194

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


1 files changed, 19 insertions(+), 8 deletions(-)

apps/web/src/components/ChatView.tsx+19-8
...@@ -4293,10 +4293,21 @@ export default function ChatView(props: ChatViewProps) {...@@ -4293,10 +4293,21 @@ export default function ChatView(props: ChatViewProps) {
4293 supportsPullRequests,4293 supportsPullRequests,
4294 threadDetailLoading,4294 threadDetailLoading,
4295 ]);4295 ]);
4296 const closePreviewPanel = useCallback(() => {
4297 if (activeThreadRef) {
4298 if (activeRightPanelSurface?.kind === "preview" && activeRightPanelSurface.resourceId) {
4299 usePreviewMiniPlayerStore
4300 .getState()
4301 .open(activeThreadRef, activeRightPanelSurface.resourceId);
4302 }
4303 setMaximizedRightPanelThreadKey(null);
4304 useRightPanelStore.getState().close(activeThreadRef);
4305 }
4306 }, [activeRightPanelSurface, activeThreadRef]);
4296 const togglePreviewPanel = useCallback(() => {4307 const togglePreviewPanel = useCallback(() => {
4297 if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;4308 if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;
4298 if (previewPanelOpen) {4309 if (previewPanelOpen) {
4299 useRightPanelStore.getState().close(activeThreadRef);4310 closePreviewPanel();
4300 return;4311 return;
4301 }4312 }
4302 const activeTabId = activePreviewState.activeTabId;4313 const activeTabId = activePreviewState.activeTabId;
...@@ -4305,13 +4316,13 @@ export default function ChatView(props: ChatViewProps) {...@@ -4305,13 +4316,13 @@ export default function ChatView(props: ChatViewProps) {
4305 } else {4316 } else {
4306 createBrowserSurface();4317 createBrowserSurface();
4307 }4318 }
4308 }, [activePreviewState.activeTabId, activeThreadRef, createBrowserSurface, previewPanelOpen]);4319 }, [
4309 const closePreviewPanel = useCallback(() => {4320 activePreviewState.activeTabId,
4310 if (activeThreadRef) {4321 activeThreadRef,
4311 setMaximizedRightPanelThreadKey(null);4322 closePreviewPanel,
4312 useRightPanelStore.getState().close(activeThreadRef);4323 createBrowserSurface,
4313 }4324 previewPanelOpen,
4314 }, [activeThreadRef]);4325 ]);
4315 const addTerminalSurface = useCallback(() => {4326 const addTerminalSurface = useCallback(() => {
4316 if (!activeThreadRef || !activeThreadId || !activeProject) return;4327 if (!activeThreadRef || !activeThreadId || !activeProject) return;
4317 const cwd = gitCwd ?? activeProject.workspaceRoot;4328 const cwd = gitCwd ?? activeProject.workspaceRoot;