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) {
42934293 supportsPullRequests,
42944294 threadDetailLoading,
42954295 ]);
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]);
42964307 const togglePreviewPanel = useCallback(() => {
42974308 if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;
42984309 if (previewPanelOpen) {
4299 useRightPanelStore.getState().close(activeThreadRef);
4310 closePreviewPanel();
43004311 return;
43014312 }
43024313 const activeTabId = activePreviewState.activeTabId;
......@@ -4305,13 +4316,13 @@ export default function ChatView(props: ChatViewProps) {
43054316 } else {
43064317 createBrowserSurface();
43074318 }
4308 }, [activePreviewState.activeTabId, activeThreadRef, createBrowserSurface, previewPanelOpen]);
4309 const closePreviewPanel = useCallback(() => {
4310 if (activeThreadRef) {
4311 setMaximizedRightPanelThreadKey(null);
4312 useRightPanelStore.getState().close(activeThreadRef);
4313 }
4314 }, [activeThreadRef]);
4319 }, [
4320 activePreviewState.activeTabId,
4321 activeThreadRef,
4322 closePreviewPanel,
4323 createBrowserSurface,
4324 previewPanelOpen,
4325 ]);
43154326 const addTerminalSurface = useCallback(() => {
43164327 if (!activeThreadRef || !activeThreadId || !activeProject) return;
43174328 const cwd = gitCwd ?? activeProject.workspaceRoot;