Skip to content

Commit a1e1c16

Browse files
committed
Fix: skip error logging and browser fallback for interrupt-only preview failures
When openPreview returns an interrupt-only failure (cancellation), the code was incorrectly logging a TerminalLinkPreviewOpenError and triggering a browser fallback. This aligns with the pattern used elsewhere in the codebase (e.g. ChatMarkdown.tsx, BranchToolbarBranchSelector.tsx) where isAtomCommandInterrupted is checked before surfacing errors.
1 parent a0ac289 commit a1e1c16

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

apps/web/src/components/preview/openTerminalLinkInPreview.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { LocalApi, ScopedThreadRef } from "@t3tools/contracts";
22
import { isPreviewableUrl } from "@t3tools/shared/preview";
33
import * as Schema from "effect/Schema";
44

5+
import { isAtomCommandInterrupted } from "@t3tools/client-runtime/state/runtime";
6+
57
import type { OpenPreviewMutation } from "~/browser/openFileInPreview";
68
import { applyPreviewServerSnapshot, isPreviewSupportedInRuntime } from "~/previewStateStore";
79
import { useRightPanelStore } from "~/rightPanelStore";
@@ -85,13 +87,15 @@ export async function openTerminalLinkInPreview<E>(
8587
input: { threadId: input.threadRef.threadId, url: input.url },
8688
});
8789
if (result._tag === "Failure") {
88-
console.error(
89-
new TerminalLinkPreviewOpenError({
90-
...errorContext,
91-
cause: result.cause,
92-
}),
93-
);
94-
input.fallbackToBrowser();
90+
if (!isAtomCommandInterrupted(result)) {
91+
console.error(
92+
new TerminalLinkPreviewOpenError({
93+
...errorContext,
94+
cause: result.cause,
95+
}),
96+
);
97+
input.fallbackToBrowser();
98+
}
9599
return;
96100
}
97101
applyPreviewServerSnapshot(input.threadRef, result.value);

0 commit comments

Comments
 (0)