From 49375da39b418788f3c3551c407429c7f129b281 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 10 Nov 2026 20:19:16 +0000 Subject: [PATCH] fix(web): project actions auto-open Preview in web clients The auto-open after a project action was gated on the desktop bridge, so web clients never opened the Preview URL even when the environment supports server-side Preview. Gate it on isPreviewAvailableFor, like the manual open paths. Fixes pingdotgg/t3code#34033 AI-assisted; verified with the tests and tools listed above. --- apps/web/src/components/chat/useChatTerminalActions.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/chat/useChatTerminalActions.ts b/apps/web/src/components/chat/useChatTerminalActions.ts index 5108b72f1afaf..a64c748e81432 100644 --- a/apps/web/src/components/chat/useChatTerminalActions.ts +++ b/apps/web/src/components/chat/useChatTerminalActions.ts @@ -28,8 +28,8 @@ import { type RightPanelSurface, useRightPanelStore, } from "../../rightPanelStore"; -import { isPreviewSupportedInRuntime } from "../../previewStateStore"; import { openUrlInPreview } from "../../browser/openFileInPreview"; +import { isPreviewAvailableFor } from "../../browser/previewRuntime"; import { resolveDiscoveredServerUrl } from "../../browser/browserTargetResolver"; import { stackedThreadToast, toastManager } from "../ui/toast"; import { confirmTerminalClose } from "../../lib/terminalCloseConfirm"; @@ -290,7 +290,11 @@ export function useChatTerminalActions(input: ChatTerminalActionsInput) { } return; } - if (script.autoOpenPreview && script.previewUrl && isPreviewSupportedInRuntime()) { + if ( + script.autoOpenPreview && + script.previewUrl && + isPreviewAvailableFor(activeThreadRef.environmentId) + ) { const previewResult = await openUrlInPreview({ threadRef: activeThreadRef, url: resolveDiscoveredServerUrl(activeThreadRef.environmentId, script.previewUrl),