Description
Describe the problem
While beta testing and after porting a Svelte 4 project, I would like to share these experiences.
It looks like the default value of $bindable is useless.
Error: props_invalid_value Cannot do
bind:value={undefined}
whenvalue
has a fallback value
Input.svelte has a $bindable with default value ''
and state in App.svelte has undefined value.
But this is, what I like to use... for example to fill data in an empty object.
The message: bind:value={undefined}
feels not correct.
I use a bind:value - and this is a shortcode for bind:value={value}
It is hard to find the error, because $bindable-line is marked as error and not the parents line.
.
But this error come up only at initial phase.
If you see my Example 2, you will note that it is possible to set undefined later.
This is not intuitive. Why I can not use undefined first - but can set undefined later?
.
Here is my Example 3 - where I don't use this useless $bindable default anymore. Instead I use an extra $effect to set right default value. It is no more possible to set undefined, because Input force a default empty string in that case.
I believe that other people will expect the same behavior like before with Svelte 4.
Otherwise it is not intuitive and require extra $effects to fix.
Describe the proposed solution
see above
Importance
would make my life easier