You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you submitting a bug report or a feature request?
Bug
What is the current behavior?
asyncValidating is set to false once the initial validation promise is complete even if subsequent async validations have been called before the first one completed.
NOTE: the asyncValidate is set to a 5 second delay.
The form will submit with 'john' successfully and will only display the error after 5 seconds( after step #3's promise completes).
If you look at the console, you can see that asyncValidating is set to false once the first promise is complete (for 'j').
What is the expected behavior?
The asyncValidating prop should be truthy as long as there is an incomplete async validation promise. It should revert to false only after all promises are complete.
@erikras - I have a couple ideas on how this issue could be resolved and would like to make a pull-request. But first I would like to know how you would prefer this be approached.
Since the form prop asyncValidating is either a bool or a string, it does not reflect multiple, asynchronous validation processes. And once the first promise resolves, asyncValidating is set to false, allowing submission while there are still incomplete async validations. Because of the described behavior I have not been able to use async change validation in production. I have considered creating support for this issue outside of redux-form but thought I would explore addressing it within the library itself first.
My initial thought was to make asyncValidating an array or bool. So that whenever START_ASYNC_VALIDATION is called, it could add to or remove from the array, allowing for multiple async validations to be tracked. (using bool still for the final call onSubmit)
This approach however does create a breaking change as it would change asyncValidating's type. And does not address the fact that requests associated with the same field would not necessarily resolve in the same order.
I would like any input on this proposal. And if there's already anything in the works surrounding this, I'd like to contribute wherever's needed.
Are you submitting a bug report or a feature request?
Bug
What is the current behavior?
asyncValidating
is set to false once the initial validation promise is complete even if subsequent async validations have been called before the first one completed.NOTE: the asyncValidate is set to a 5 second delay.
The form will submit with 'john' successfully and will only display the error after 5 seconds( after step #3's promise completes).
If you look at the console, you can see that
asyncValidating
is set to false once the first promise is complete (for 'j').What is the expected behavior?
The
asyncValidating
prop should be truthy as long as there is an incomplete async validation promise. It should revert to false only after all promises are complete.Sandbox Link
sandbox
What's your environment?
redux-form 7.3.0
Other information
The text was updated successfully, but these errors were encountered: