Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
If an async validator returns a rejected promise, the form submission will hit an infinite loop and hang the browser tab.
I modified the async validation demo from react-final-form to demonstrate the issue.
https://codesandbox.io/s/x2xpy832yq
What is the expected behavior?
There is a comment in the source about not handling rejected promises here:
https://github.com/final-form/final-form/blob/v4.10.0/src/FinalForm.js#L303
If thats limitation is needed then I would expect an error to be thrown by final form. Whatever the solution, an infinite loop causing a hanging browser tab isn't the expected behavior.
Sandbox Link
https://codesandbox.io/s/x2xpy832yq
What's your environment?
final-form: 4.10.0
OS: OSX
Browser: Chrome
Other information
From the code you can see that the rejection case on promises from field validation isn't handled so 'clearAsyncValidationPromise' is never called. If that function is never called the promise sits around waiting to be 'resolved' and the submit function spins forever.
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
If an async validator returns a rejected promise, the form submission will hit an infinite loop and hang the browser tab.
I modified the async validation demo from react-final-form to demonstrate the issue.
https://codesandbox.io/s/x2xpy832yq
What is the expected behavior?
There is a comment in the source about not handling rejected promises here:
https://github.com/final-form/final-form/blob/v4.10.0/src/FinalForm.js#L303
If thats limitation is needed then I would expect an error to be thrown by final form. Whatever the solution, an infinite loop causing a hanging browser tab isn't the expected behavior.
Sandbox Link
https://codesandbox.io/s/x2xpy832yq
What's your environment?
final-form: 4.10.0
OS: OSX
Browser: Chrome
Other information
From the code you can see that the rejection case on promises from field validation isn't handled so 'clearAsyncValidationPromise' is never called. If that function is never called the promise sits around waiting to be 'resolved' and the submit function spins forever.