-
Notifications
You must be signed in to change notification settings - Fork 1
fix(validations): Fix handling of async validations as well as order of onChange notification #57
Conversation
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
- Coverage 67.19% 66.89% -0.31%
==========================================
Files 22 22
Lines 445 447 +2
Branches 92 92
==========================================
Hits 299 299
- Misses 116 118 +2
Partials 30 30
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
- Coverage 67.19% 66.89% -0.31%
==========================================
Files 22 22
Lines 445 447 +2
Branches 92 92
==========================================
Hits 299 299
- Misses 116 118 +2
Partials 30 30
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
- Coverage 67.19% 66.89% -0.31%
==========================================
Files 22 22
Lines 445 447 +2
Branches 92 92
==========================================
Hits 299 299
- Misses 116 118 +2
Partials 30 30
Continue to review full report at Codecov.
|
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.
LGTM, I will QA. It seems like this component could use some tests, but that can be handled in a separate PR.
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.
lgtm, if its quick would be nice to update the formbot example to showcase async validation with something simple like a setTimeout
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.
gogogogo
* v5: feat(Button): Icon support and default style updates (#51) feat(Colors): Updates colors (#60) chore(release): 4.1.6 fix(FormError): Fix crash in case context is null (#59) chore(release): 4.1.5 fix: Use updater function in setState for Formbot updates (#58) chore(release): 4.1.4 fix(validations): Fix handling of async validations as well as order of onChange notification (#57) chore(release): 4.1.3 Async Formbot Validations (#56)
It was discovered when refactoring the
AddressForm
component that theonChange
notification inFormBot
was called before field updating/validation was complete. This is an issue if in anonChange
handler forFormBot
you are expecting to test for form validity (i.e. updating your UI according to the validity of a recent change to form data). Additionally thereturn
from the async validation block was triggering thefinally
handler causing premature promise resolution and triggering theonChange
handler before validations were complete.