final-form / final-form

🏁 Framework agnostic, high performance, subscription-based form state management

Home Page:https://final-form.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reset while onSubmit

bertho-zero opened this issue · comments

Throw error if attempt to reset() when submitting (#229)

I think this is a bad approach:

It is common to want to empty the form during / after submission, this should not throw an error and the use of a setTimeout brings (potential) visual glitch and useless re-render.

Rather than an error we could have an internal state which monitors if reset is called during the submit (state.resetWhileSubmitting), then at the end of the submit if state.resetWhileSubmitting is true we can do the necessary.

Fix released in v4.20.2.