Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reacting to onSubmit Promise rejection #464

Open
taras-yurts opened this issue Oct 4, 2022 · 1 comment
Open

Reacting to onSubmit Promise rejection #464

taras-yurts opened this issue Oct 4, 2022 · 1 comment

Comments

@taras-yurts
Copy link

taras-yurts commented Oct 4, 2022

Submitting a bug report or a feature request:

Technically a feature request based on the contradiction with docs wording

Current behavior:

Currently, the form state doesn't change if there is some Promise rejection in the onSubmit handler, moreover submitSucceeded property turns true if that happens. Even though, according to the docs, there is a statement saying 'leaving rejection for when there is a server or communications error' and it seems that the form should consider some handling for rejection(server or communications error) case.

Expected behavior:

From the docs it seems that in case of some rejection(server or communications error) in the submit handler there should be some forms property or handler reacting to that and at least the form's submission shouldn't be considered as succeeded.

Environment:

react-final-form: 6.5.9
final-form: 4.20.7
node: 16.14.2
npm: 8.1.4

OS: Windows
Browser: Chrome 106.0.5249.91

@andriy-kudrya-eleks
Copy link

andriy-kudrya-eleks commented Oct 17, 2022

Yeah, setting submitSucceeded = true after request (and promise) failure is a surprising behavior. Is it designed to be this way or is it a bug?

I'd rather expect setting submitFailed = ture. In a case submitFailed is reserved only for a case when request promise is resolved with an error object then it is better to not change form state at all. Currently, final-form behaves as if request was successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants