From 873ec2b4d559adb969148113fe883696cf00fa0a Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:38:42 +0200 Subject: [PATCH] fix: asynchronously instantiate components when using Svelte 5 (#12613) Adjusts the behavior to that of the new `mount`/`hydrate` APIs and also fixes #12248 --- .changeset/big-vans-destroy.md | 5 +++++ packages/kit/src/runtime/client/client.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/big-vans-destroy.md diff --git a/.changeset/big-vans-destroy.md b/.changeset/big-vans-destroy.md new file mode 100644 index 000000000000..7cd0ebaac12a --- /dev/null +++ b/.changeset/big-vans-destroy.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: asynchronously instantiate components when using Svelte 5 diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js index f91728bccc2c..f828720b88c0 100644 --- a/packages/kit/src/runtime/client/client.js +++ b/packages/kit/src/runtime/client/client.js @@ -434,7 +434,9 @@ function initialize(result, target, hydrate) { root = new app.root({ target, props: { ...result.props, stores, components }, - hydrate + hydrate, + // @ts-ignore Svelte 5 specific: asynchronously instantiate the component, i.e. don't call flushSync + sync: false }); restore_snapshot(current_navigation_index);