fix(vscode): avoid navigation reload on chunk load failure

Browser-style chunk recovery used location.reload inside VS Code webviews, where navigation reload is unsupported. Preserve import retries and let the original failure reach the error boundary instead.

Validated with focused regression tests, UI type-check and lint, and the VS Code webview build. The reported gray-screen crash has not been reproduced.
This commit is contained in:
Bohdan Triapitsyn
2026-09-09 17:41:15 +03:00
parent 8cb426083b
commit 432f3bb9df
3 changed files with 43 additions and 0 deletions
+4
View File
@@ -1,4 +1,5 @@
import { lazy } from 'react';
import { isVSCodeRuntime } from './desktop';
declare const __APP_VERSION__: string | undefined;
@@ -42,6 +43,9 @@ function reloadMarkerSignature(error: unknown): string {
function scheduleReloadOnce(error: unknown): void {
if (typeof window === 'undefined') return;
// VS Code owns webview navigation. Keep the import failure available to the
// error boundary instead of replacing the app with an unsupported reload.
if (isVSCodeRuntime()) return;
const now = Date.now();
const signature = reloadMarkerSignature(error);