Skip to content

Commit f88b77b

Browse files
committed
Don't trigger error bounsary prior to lazy route discovery manifest mismatch reload
1 parent 6ae3663 commit f88b77b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/silly-ligers-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
Don't trigger an `ErrorBoundary` UI before the reload when we detect a manifest verison mismatch in Lazy Route Discovery

packages/react-router/lib/dom/ssr/fog-of-war.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,13 @@ export async function fetchAndApplyManifestPatches(
254254

255255
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
256256
window.location.href = errorReloadPath;
257-
throw new Error("Detected manifest version mismatch, reloading...");
257+
console.warn("Detected manifest version mismatch, reloading...");
258+
259+
// Stall here and let the browser reload and avoid triggering a flash of
260+
// an ErrorBoundary if we threw (same thing we do in `loadRouteModule()`)
261+
await new Promise(() => {
262+
// check out of this hook cause the DJs never gonna re[s]olve this
263+
});
258264
} else if (res.status >= 400) {
259265
throw new Error(await res.text());
260266
}

0 commit comments

Comments
 (0)