fix: consistently set value to blank string when value attribute is undefined#15057
fix: consistently set value to blank string when value attribute is undefined#15057dummdidumm merged 2 commits intosveltejs:mainfrom
Conversation
|
preview: https://svelte-dev-git-preview-svelte-15057-svelte.vercel.app/ this is an automated message |
|
a76f967 to
7ac2de6
Compare
|
7ac2de6 to
fd9dbd2
Compare
fd9dbd2 to
3d10f41
Compare
|
@dummdidumm Can you review this? We ran into bugs from this where an input value was set from an optional URL param. E.g: <input name="address" value={params.address} />This appears to work great at first, since when the parameter isn't set initially the input is blank, and when the parameter is added it is displayed as expected in the input. But if a subsequent navigation removes the parameter after it had been set, the input unexpectedly shows "undefined". |
|
Looks good, thanks! Add a changeset and we're good to merge 👍 |
Previously there was an inconsistency where a
valueattribute (correctly) wasn't set if initiallyundefined(resulting in the input value being a blank string), but if thevalueattribute was first set to a non-nullish value, and then changed toundefined, then the string "undefined" would appear as the input value, rather than the expected empty string.Fixes #4467