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
I have a form that can be submitted many times. When a submission is successful the form is cleared out and the user is free to fill it in again.
The form contains a text field which is required. If the text field has focus when I press the submit button it loses focus and the onBlur event schedules the field to be validated after a 300ms delay. If the submission is very quick then the form is cleared out before the delayed validation happens and I end up with an error message next to the now empty field saying that it is required, even though everything actually went well.
Since validation occurs before onSubmit/onInvalidSubmit is called, I expected that to be enough and not for the delayed field validation to linger. Generally, any time the whole form is validated there should be no need to validate again unless something changes. I don't see a way to cancel the timeouts myself nor any way to reliably wait for them before clearing out the form.
Looking at src/Form.js, maybe the flush-validations timeout could be cleared in submit()?
The text was updated successfully, but these errors were encountered:
I have a form that can be submitted many times. When a submission is successful the form is cleared out and the user is free to fill it in again.
The form contains a text field which is required. If the text field has focus when I press the submit button it loses focus and the
onBlur
event schedules the field to be validated after a 300ms delay. If the submission is very quick then the form is cleared out before the delayed validation happens and I end up with an error message next to the now empty field saying that it is required, even though everything actually went well.Since validation occurs before
onSubmit
/onInvalidSubmit
is called, I expected that to be enough and not for the delayed field validation to linger. Generally, any time the whole form is validated there should be no need to validate again unless something changes. I don't see a way to cancel the timeouts myself nor any way to reliably wait for them before clearing out the form.Looking at
src/Form.js
, maybe theflush-validations
timeout could be cleared insubmit()
?The text was updated successfully, but these errors were encountered: