Skip to content

Commit 0c38bd3

Browse files
authored
prevent unhandled rejections when loading page modules - fixes #3978 (#4732)
1 parent fc3005e commit 0c38bd3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/silver-elephants-attack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
Prevent unhandled rejections when loading page modules

packages/kit/src/runtime/client/client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,10 @@ export function create_client({ target, session, base, trailing_slash }) {
612612
/** @type {Error | null} */
613613
let error = null;
614614

615-
// preload modules
616-
a.forEach((loader) => loader());
615+
// preload modules to avoid waterfall, but handle rejections
616+
// so they don't get reported to Sentry et al (we don't need
617+
// to act on the failures at this point)
618+
a.forEach((loader) => loader().catch(() => {}));
617619

618620
load: for (let i = 0; i < a.length; i += 1) {
619621
/** @type {import('./types').BranchNode | undefined} */

0 commit comments

Comments
 (0)