Form cannot be resubmitted after setting onSubmit.form error via setErrorMap unless a field value changes
#2021
Unanswered
ludwighogstrom
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋
I’m running into an issue with handling temporary server errors in TanStack Form and wanted to sanity-check my approach.
I have a login form using
useAppForm(wrapper arounduseForm) that submits to an API. On server failure, I’m storing the error usingsetErrorMapunderonSubmit.form.Problem
After
setErrorMap({ onSubmit })is called:onSubmitdoes not fireThis makes it difficult to handle temporary server errors (e.g. network issue, 500, rate limit), where the user should be able to simply click “Submit” again without changing anything.
Questions
onSubmit.formthe correct place to store server-side submission errors?onSubmit.formintentionally block resubmission until form state changes?I may be misunderstanding the intended semantics of
onSubmit.form, so any guidance on what that error bucket is designed for would be super helpful.Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions