Describe the bug#
When handleSubmit is called while canSubmit is false an early return is hit and onSubmitInvalid is not called.
https://github.com/TanStack/form/blob/1e58e57987e4f79fb23d0034d1cdceebb9a7299b/packages/form-core/src/FormApi.ts#L1918
Your minimal, reproducible example#
https://stackblitz.com/edit/tanstack-form-dqy8vhes?file=src%2Findex.tsx
Steps to reproduce#
- Go to the Stackblitz
- 👁️ Observe:
"canSubmit": false, (see JSON-dump in <pre>-Tag)
- Click the Submit Button
- 👁️ Observe: No
console.log for "onSubmitInvalid"
Expected behavior#
As a User I expect form.onSubmitInvalid to be called whenever the form is submitted in an invalid state
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
irrelevant
TanStack Form adapter#
react-form
TanStack Form version#
1.19.2
TypeScript version#
No response
Additional context#
No response