From 0075ca2bb202eaa4dd7f98790ad557b46ab94164 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Sat, 20 Jun 2026 10:17:49 +0000 Subject: [PATCH] Clarify markdown preview fallback toast Co-authored-by: Codex Co-authored-by: codex --- apps/web/src/components/ChatMarkdown.tsx | 19 +++++++++++++------ apps/web/src/components/ChatView.tsx | 6 +++++- apps/web/src/components/DiffPanel.tsx | 6 +++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx index 712f473579..014fe17aad 100644 --- a/apps/web/src/components/ChatMarkdown.tsx +++ b/apps/web/src/components/ChatMarkdown.tsx @@ -1060,9 +1060,12 @@ const MarkdownFileLink = memo(function MarkdownFileLink({ const error = squashAtomCommandFailure(result); toastManager.add( stackedThreadToast({ - type: "error", - title: "Unable to open file in browser", - description: error instanceof Error ? error.message : "An error occurred.", + type: "warning", + title: "Unable to open file preview", + description: + error instanceof Error + ? `${error.message} Opening the file instead.` + : "Opening the file instead.", }), ); handleOpenInFilePreview(); @@ -1073,9 +1076,12 @@ const MarkdownFileLink = memo(function MarkdownFileLink({ ); toastManager.add( stackedThreadToast({ - type: "error", - title: "Unable to open file in browser", - description: cause instanceof Error ? cause.message : "An error occurred.", + type: "warning", + title: "Unable to open file preview", + description: + cause instanceof Error + ? `${cause.message} Opening the file instead.` + : "Opening the file instead.", }), ); handleOpenInFilePreview(); @@ -1470,6 +1476,7 @@ function ChatMarkdown({ threadRef={threadRef} onOpen={openInPreferredEditor} onOpenInBrowser={ + fileLinkMeta.workspaceRelativePath !== null && threadRef && isPreviewSupportedInRuntime() && isWorkspacePreviewFile(fileLinkMeta.filePath) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index cac7b81a5d..126a76be1f 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -2776,7 +2776,11 @@ function ChatViewContent(props: ChatViewProps) { createAssetUrl, openPreview, }); - if (result._tag === "Success" || isAtomCommandInterrupted(result)) { + if (result._tag === "Success") { + return; + } + if (isAtomCommandInterrupted(result)) { + openFallback(); return; } const error = squashAtomCommandFailure(result); diff --git a/apps/web/src/components/DiffPanel.tsx b/apps/web/src/components/DiffPanel.tsx index 341bb553a7..bd559e2aa7 100644 --- a/apps/web/src/components/DiffPanel.tsx +++ b/apps/web/src/components/DiffPanel.tsx @@ -503,7 +503,11 @@ export default function DiffPanel({ mode = "inline", composerDraftTarget }: Diff createAssetUrl, openPreview, }); - if (result._tag === "Success" || isAtomCommandInterrupted(result)) { + if (result._tag === "Success") { + return; + } + if (isAtomCommandInterrupted(result)) { + openFallback(); return; } const error = squashAtomCommandFailure(result);