After async validation, field is dirty but the form state is not #11204
Unanswered
ktalalykin
asked this question in
Q&A
Replies: 1 comment
-
|
while playing around, i found a temporary solution, adding |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a form where one of the fields' validation relies on the API request which i need to wait for in order to make decision on whether the form is valid or not. What seems to be the issue is that if in that field i rapidly type characters before the async validation has finished for the previous values, form state is not updated correctly as it doesnt update
isDirtyproperty at all, while field itself is marked dirty as expected. Moreover, this breaks the rest of the form as typing in another, non async field doesnt update form state, until one of the values is changed back to its' default.For the example purposes i substituted API request with set timeout of 500ms which resolves the promise. Here is the sandbox https://codesandbox.io/s/naughty-colden-mwskgy?file=/src/App.js
Beta Was this translation helpful? Give feedback.
All reactions