-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behaviour when setting input binding value to undefined
#3569
Comments
Bigger example where initial rendering is different than the subsequent rendering is here: https://svelte.dev/repl/badaddc85db64c24a048d094b76df6de?version=3.12.1 |
These are very old issues, can't even open the associated repls. One issue seems about text nodes instead of input values. As i already said, not sure if this is a bug. So somebody has to make that call. At least the behaviour is inconsistent, because the first render makes undefined display as empty strings and the rerender will display them as text |
@Conduitry I would say there is a bug here. The effect that setting I don't think it relates to the linked issues. |
undefined
There's a bug where when `<input bind:value={sampleVar} />` and `sampleVar` is updated to undefined (`sampleVar = undefined`), then the input displays "undefined" (despite the input initally showing up correctly empty when initialized to undefined). This issue has been documented since September 14, 2019 sveltejs#3569 I'm new to Svelte, but this seems to fix this problem.
Agree with that assessment. Fixed via #4849 |
This has been fixed in 3.23.0 - https://svelte.dev/repl/49192f00b721451cb581a1c9e60d4001?version=3.23.0 |
There's a bug where when `<input bind:value={sampleVar} />` and `sampleVar` is updated to undefined (`sampleVar = undefined`), then the input displays "undefined" (despite the input initally showing up correctly empty when initialized to undefined). This issue has been documented since September 14, 2019 sveltejs#3569 I'm new to Svelte, but this seems to fix this problem.
Describe the bug
The initial rendering of the undefined value results in an empty input. Assigning a bound input value to
undefined
makes the input display the textundefined
. Not sure if this is a bug, but it the behaviour feels inconsistent.To Reproduce
Made a small repl: https://svelte.dev/repl/49192f00b721451cb581a1c9e60d4001?version=3.12.1
Expected behavior
The assignment of an undefined value would work like null assignment (input displays empty). Or if this is undesired it would be nice if the initial rendering would also display
undefined
so that its more obvious that assigning undefined values is the wrong thing to do.Information about your Svelte project:
Your browser and the version: Firefox 69
Your operating system: Ubuntu Linux 18.04
Svelte version 3.12.1
Severity
Workaround is not using
undefined
values, so its not really blocking in any way.The text was updated successfully, but these errors were encountered: