Skip to content

Commit

Permalink
fix: use field default value only when value is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrille Perois committed Jan 31, 2024
1 parent f1b85f9 commit 36a5fa8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export const useField = (fieldName: string): FieldProps => {
const fieldErrors = errors?.[fieldName] || [];

return {
value: fieldValue ?? fieldSchema.default,
value: fieldValue === undefined ? fieldSchema.default : fieldValue,
onChange,
name: fieldName,
id: fieldNameToId(fieldName),
Expand Down

0 comments on commit 36a5fa8

Please sign in to comment.