@devries-cameron20 / t3code Mirror · read-only / commits / 0882431e0f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 02:45 UTC

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

maria committed Sep 10, 2026 at 15:25 UTC 0882431e0fc0fabe950743dd44b674a07a584bc9
1 file changed +19 -8
apps/web/src/components/ChatView.tsx
+19 -8
@@ -4293,10 +4293,21 @@ export default function ChatView(props: ChatViewProps) {
4293 supportsPullRequests,
4294 threadDetailLoading,
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]);
4307 const togglePreviewPanel = useCallback(() => {
4308 if (!activeThreadRef || !isPreviewSupportedInRuntime()) return;
4309 if (previewPanelOpen) {
4299 - useRightPanelStore.getState().close(activeThreadRef);
4310 + closePreviewPanel();
4311 return;
4312 }
4313 const activeTabId = activePreviewState.activeTabId;
@@ -4305,13 +4316,13 @@ export default function ChatView(props: ChatViewProps) {
4316 } else {
4317 createBrowserSurface();
4318 }
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 + ]);
4326 const addTerminalSurface = useCallback(() => {
4327 if (!activeThreadRef || !activeThreadId || !activeProject) return;
4328 const cwd = gitCwd ?? activeProject.workspaceRoot;