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);