Skip to content
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

Merged

Conversation

abdalla-rko
Copy link
Contributor

@abdalla-rko abdalla-rko commented Feb 15, 2025

Reasons for making this change

Fixes #4365

Checklist

  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a

Copy link
Member

@heath-freenome heath-freenome left a 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') {
Copy link
Member

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.

Copy link
Contributor Author

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.

@heath-freenome heath-freenome merged commit e74cc88 into rjsf-team:main Feb 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom validation error doesn't hide on good result
2 participants