Skip to content

Commit

Permalink
fix(validateFieldsNatively): handle undefined object when reading 're…
Browse files Browse the repository at this point in the history
…fs' (#734)
  • Loading branch information
jorisre authored Jan 30, 2025
1 parent 7807f95 commit 3da2054
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/validateFieldsNatively.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const validateFieldsNatively = <TFieldValues extends FieldValues>(
const field = options.fields[fieldPath];
if (field && field.ref && 'reportValidity' in field.ref) {
setCustomValidity(field.ref, fieldPath, errors);
} else if (field.refs) {
} else if (field && field.refs) {
field.refs.forEach((ref: HTMLInputElement) =>
setCustomValidity(ref, fieldPath, errors),
);
Expand Down

0 comments on commit 3da2054

Please # to comment.