svelte-schema-form icon indicating copy to clipboard operation
svelte-schema-form copied to clipboard

Number '0' value is deleted

Open facetious opened this issue 7 months ago • 0 comments

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.

facetious avatar Jul 08 '24 18:07 facetious