Skip to content

Commit a71b45b

Browse files
fix Sentry errors related to schema-editor dynamic import (#7990)
1 parent 730771f commit a71b45b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/web/app/src/main.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ clearChunkReloadFlag();
2222
// a chunk or its CSS/JS dependencies fail to load. We catch it here and reload
2323
// the page so the browser fetches fresh HTML with the correct chunk references.
2424
// See: https://vite.dev/guide/build.html#load-error-handling
25-
window.addEventListener('vite:preloadError', event => {
26-
// Prevent the error from propagating — we're handling it with a reload.
27-
event.preventDefault();
25+
window.addEventListener('vite:preloadError', () => {
26+
// Don't call preventDefault() — that flips Vite into a silent branch where
27+
// the failed import resolves to `undefined`, causing downstream destructures
28+
// (e.g. lazy() callers) to throw a cryptic TypeError before the reload runs.
29+
// Letting the error propagate routes it through the unhandledrejection and
30+
// error-boundary handlers below, which also reload on isChunkLoadError.
2831
reloadOnChunkError();
2932
});
3033

0 commit comments

Comments
 (0)