-
-
Notifications
You must be signed in to change notification settings - Fork 579
Open
Description
Describe the bug
The example code to use TanStack Form with Server Actions in Next has several deficiencies.
It seems that the form submission/calling the action is happening natively and completely skipping the TanStack Form. That means that:
- the form can be cumitted even if it is not valid
formState.isSubmittingis never trueonSubmitfunction is never exectured, unless you adde.preventDefault()to<form onSubmit>- And all other things that are related to TanStack Form not being hooked on the Form sumission.
Your minimal, reproducible example
https://github.com/tanstack/form/tree/main/examples/react/next-server-actions
Steps to reproduce
- Checkout the code from https://github.com/tanstack/form/tree/main/examples/react/next-server-actions and run it
- Optionally add
await new Promise(resolve => setTimeout(resolve, 2000));to./src/app /action.tsto be able to observe the behaviour easier - Submit the form.
isSubmittingis never true, so the submit button always remains the same.
Expected behavior
The isSubmitting state should be changed when the form is being submitted.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Windows 11
- Browser: Chrome
TanStack Form adapter
react-form
TanStack Form version
v1.27.7
TypeScript version
v5.9.3
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels