svelte-schema-form
svelte-schema-form copied to clipboard
Number '0' value is deleted
When a falsy value is used for a Number
field, it is replaced with ''
. Because 0
is a falsy value, attempting to show a field with an initial value of 0
results in an empty field.
See: https://github.com/restspace/svelte-schema-form/blob/master/src/lib/editors/Number.svelte#L11
Correcting this to use value={typeof value === "number" ? value : ''}
is probably good enough, though pre-assigned data that had a string value "5" would be deleted instead. Probably want to leverage the on:input
for the initial value here.