Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/selfish-seas-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

fix: allow mutation of data and form props in Svelte 5
12 changes: 9 additions & 3 deletions packages/kit/src/core/sync/write_root.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ export function write_root(manifest_data, output) {

let l = max_depth;

let pyramid = `<svelte:component this={constructors[${l}]} bind:this={components[${l}]} data={data_${l}} {form} />`;
let pyramid = `<svelte:component this={constructors[${l}]} bind:this={components[${l}]} ${
isSvelte5Plus() ? `bind:data={data_${l}} bind:form` : `data={data_${l}} {form}`
} />`;

while (l--) {
pyramid = dedent`
{#if constructors[${l + 1}]}
<svelte:component this={constructors[${l}]} bind:this={components[${l}]} data={data_${l}}>
<svelte:component this={constructors[${l}]} bind:this={components[${l}]} ${
isSvelte5Plus() ? `bind:data={data_${l}}` : `data={data_${l}}`
}>
${pyramid}
</svelte:component>
{:else}
<svelte:component this={constructors[${l}]} bind:this={components[${l}]} data={data_${l}} {form} />
<svelte:component this={constructors[${l}]} bind:this={components[${l}]} ${
isSvelte5Plus() ? `bind:data={data_${l}} bind:form` : `data={data_${l}} {form}`
} />
{/if}
`;
}
Expand Down