Skip to content

Commit d8fb0bb

Browse files
Fix input with bind:value displaying "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 #3569 I'm new to Svelte, but this seems to fix this problem.
1 parent a1b0295 commit d8fb0bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/internal/dom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export function set_data(text, data) {
193193

194194
export function set_input_value(input, value) {
195195
if (value != null || input.value) {
196-
input.value = value;
196+
input.value = value || '';
197197
}
198198
}
199199

0 commit comments

Comments
 (0)