-
Notifications
You must be signed in to change notification settings - Fork 89
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
Form level validation state mutation #719
Conversation
Codecov Report
@@ Coverage Diff @@
## state-manager #719 +/- ##
=================================================
+ Coverage 93.06% 93.13% +0.07%
=================================================
Files 220 220
Lines 3574 3613 +39
Branches 1133 1138 +5
=================================================
+ Hits 3326 3365 +39
Misses 248 248
Continue to review full report at Codecov.
|
03fe94e
to
14627f9
Compare
/** | ||
* Fields have to be revalidated on field level to synchronize the form and field errors | ||
*/ | ||
revalidateFields(currentInvalidFields); |
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.
Can we avoid this? This is not how the form currently behaves (check it here) and it brings performance issues (why to validate fields that have been already validated?)
Also, it means that active field is being validated 2x: field validation > form validation > field validation
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.
It definitely can and should be. I wanted to postpone this after we have the memorize functionality implemented because that is a big part of it.
The validation will have have to run twice at some point (it does in the example as well) because the validation functions are different.
Once we have the memo we can "save" the active field revalidation by running the field level after the form level and check if it was validated in that cycle.
🎉 This PR is included in version 3.1.0 🎉 The release is available on Demo can be found here! |
part of #687
Changes