Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
When using asynchronous field-level validation, the validating state is initially set to true when the validation is triggered. However, if you make another change (and trigger the validate function again) while the first one is ongoing, the validating FieldState is then reset to false when the first Promise fulfills, even though the second one is still ongoing. So the field is technically still validating, but the FieldState doesn't reflect this.
E.g. set up an async validate function that returns an error after 2 seconds. Make a change to your field, then 1 second later, make another change.
What is the expected behavior?
The validating property on the FieldState correctly indicates if validation is ongoing.
Sandbox Link
https://codesandbox.io/p/sandbox/final-form-async-field-issue-hd93sm
What's your environment?
Latest versions
Other information
I have included instructions in the codesandbox link as well.
(I've set this up using react-final-form for ease, but it's reproducible with just final-form as well.)
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
When using asynchronous field-level validation, the
validatingstate is initially set to true when the validation is triggered. However, if you make another change (and trigger thevalidatefunction again) while the first one is ongoing, thevalidatingFieldStateis then reset tofalsewhen the first Promise fulfills, even though the second one is still ongoing. So the field is technically still validating, but theFieldStatedoesn't reflect this.E.g. set up an async
validatefunction that returns an error after 2 seconds. Make a change to your field, then 1 second later, make another change.What is the expected behavior?
The
validatingproperty on theFieldStatecorrectly indicates if validation is ongoing.Sandbox Link
https://codesandbox.io/p/sandbox/final-form-async-field-issue-hd93sm
What's your environment?
Latest versions
Other information
I have included instructions in the codesandbox link as well.
(I've set this up using
react-final-formfor ease, but it's reproducible with justfinal-formas well.)