Skip to content

Commit

Permalink
- Made name more correct
Browse files Browse the repository at this point in the history
  • Loading branch information
heath-freenome committed Sep 20, 2024
1 parent 0511bc8 commit 7131348
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -604,18 +604,18 @@ export default class Form<
if (resolvedSchema?.type !== 'object' && resolvedSchema?.type !== 'array') {
filteredErrors.__errors = schemaErrors.__errors;
}
// Removing undefined and empty errors.
const filterUndefinedErrors = (errors: any): ErrorSchema<T> => {
// Removing undefined, null and empty errors.
const filterNilOrEmptyErrors = (errors: any): ErrorSchema<T> => {
_forEach(errors, (errorAtKey, errorKey: keyof typeof errors) => {
if (_isNil(errorAtKey)) {
delete errors[errorKey];
} else if (typeof errorAtKey === 'object' && !Array.isArray(errorAtKey.__errors)) {
filterUndefinedErrors(errorAtKey);
filterNilOrEmptyErrors(errorAtKey);
}
});
return errors;
};
return filterUndefinedErrors(filteredErrors);
return filterNilOrEmptyErrors(filteredErrors);
}

/** Function to handle changes made to a field in the `Form`. This handler receives an entirely new copy of the
Expand Down

0 comments on commit 7131348

Please sign in to comment.