From 917ad40400f4a0596698af4855a5242824fd459d Mon Sep 17 00:00:00 2001 From: Jonathan Brennan Date: Thu, 16 Apr 2026 18:09:25 -0500 Subject: [PATCH] remove preventDefault --- packages/web/app/src/main.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/web/app/src/main.tsx b/packages/web/app/src/main.tsx index 2bb7cda9782..bd214237c07 100644 --- a/packages/web/app/src/main.tsx +++ b/packages/web/app/src/main.tsx @@ -22,9 +22,12 @@ clearChunkReloadFlag(); // a chunk or its CSS/JS dependencies fail to load. We catch it here and reload // the page so the browser fetches fresh HTML with the correct chunk references. // See: https://vite.dev/guide/build.html#load-error-handling -window.addEventListener('vite:preloadError', event => { - // Prevent the error from propagating — we're handling it with a reload. - event.preventDefault(); +window.addEventListener('vite:preloadError', () => { + // Don't call preventDefault() — that flips Vite into a silent branch where + // the failed import resolves to `undefined`, causing downstream destructures + // (e.g. lazy() callers) to throw a cryptic TypeError before the reload runs. + // Letting the error propagate routes it through the unhandledrejection and + // error-boundary handlers below, which also reload on isChunkLoadError. reloadOnChunkError(); });