| ... | @@ -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; |