Skip to content

Commit

Permalink
Merge pull request #7231 from marmelab/fix-parse-useinput
Browse files Browse the repository at this point in the history
Fix empty values treated as undefined in parse function
  • Loading branch information
djhi authored Feb 14, 2022
2 parents b233c63 + 94382ac commit efc8969
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ra-core/src/form/useInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const useInput = (props: InputProps): UseInputValue => {
const eventOrValue = (typeof event[0]?.target?.checked ===
'boolean' && event[0]?.target?.value === 'on'
? event[0].target.checked
: event[0]?.target?.value || event[0]) as any;
: event[0]?.target?.value ?? event[0]) as any;
controllerField.onChange(
parse ? parse(eventOrValue) : eventOrValue
);
Expand Down

0 comments on commit efc8969

Please sign in to comment.