-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Custom validate errors are not cleared when the form is valid #4499
Bug: Custom validate errors are not cleared when the form is valid #4499
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abdalla-rko Can you provide unit tests for these changes
const { customValidate, uiSchema } = this.props; | ||
const prevFormData = this.state.formData as T; | ||
let customValidateErrors = {}; | ||
if (typeof customValidate === 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the lodash
isFunction()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using typeof === 'function'
in multiple places and I see that we never use lodash isFunction. If you think it's an improvement I can change it here and everywhere else.
Reasons for making this change
Fixes #4365
Checklist
npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update
to update snapshots, if needed.