-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
During migration to Svelte 5, I ran into this regression when spreading $$props over a component that has binded value will unbind this value.
This behaviour occurs only in Svelte 5.
This can be easily fixed by changing the bind declaration, but debugging was quite an ordeal as it broke most forms.
<!-- This will break the binding -->
<Input bind:value {...$$props} />
<!-- This works well because the binding has bigget priority and overrides the $$props -->
<Input {...$$props} bind:value />Note that if I do the same on input element level, it works fine:
<input type="text" bind:value {...$$props} />Reproduction link
https://svelte.dev/playground/af8208f936e5403994c7b91a0f7843eb?version=5.7.0
Reproduction code
<!-- App.svelte -->
<script>
import InputField from './InputField.svelte';
let value = '';
</script>
<InputField bind:value />
<div>Controlled value: {value}</div><!-- InputField.svelte -->
<script>
import Input from './Input.svelte';
export let value;
</script>
<Input bind:value {...$$props} /><!-- Input.svelte -->
<script>
export let value;
</script>
<input type="text" bind:value />System Info
Severity
annoyance
janjaromirhorak and EskelCz
Metadata
Metadata
Assignees
Labels
No labels