Skip to content

Commit

Permalink
Fix input with bind:value displaying "undefined"
Browse files Browse the repository at this point in the history
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 #3569

I'm new to Svelte, but this seems to fix this problem.
  • Loading branch information
JeremyBernier authored May 17, 2020
1 parent a1b0295 commit d8fb0bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/internal/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function set_data(text, data) {

export function set_input_value(input, value) {
if (value != null || input.value) {
input.value = value;
input.value = value || '';
}
}

Expand Down

0 comments on commit d8fb0bb

Please sign in to comment.