diff --git a/.changeset/hip-elephants-judge.md b/.changeset/hip-elephants-judge.md new file mode 100644 index 000000000000..95f303163db2 --- /dev/null +++ b/.changeset/hip-elephants-judge.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +Ensure router is initialized before parsing location diff --git a/packages/kit/src/runtime/client/renderer.js b/packages/kit/src/runtime/client/renderer.js index 047671e201d1..537c2dee7619 100644 --- a/packages/kit/src/runtime/client/renderer.js +++ b/packages/kit/src/runtime/client/renderer.js @@ -109,7 +109,7 @@ export class Renderer { this.stores.session.subscribe(async (value) => { this.$session = value; - if (!ready) return; + if (!ready || !this.router) return; this.session_id += 1; const info = this.router.parse(new URL(location.href));