-
-
Notifications
You must be signed in to change notification settings - Fork 500
Open
Labels
Description
Describe the bug
The issue is that if you use the form's reset function from inside the form's onSubmit with new default values, they will be ignored.
This only happens if used in combination with form store-related watches such as "isDirty"
From the troubleshooting done by @LeCarbonator , it appears to be a race condition between handleSubmit and reset.
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-jd2ttqqx?file=src%2FApp.tsx
Steps to reproduce
- Uncheck the checkbox.
- Click the Submit button
- See how the form goes back to the original default values instead of the new ones.
Expected behavior
Since we are calling the reset function with new values, those values should become the new form values.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Any
- Browser: Any
- Node Version: 22
TanStack Form adapter
react-form
TanStack Form version
1.18.0
TypeScript version
v5.8.3
Additional context
A chat around this issue can be found here
LeCarbonator, romulovalez, Jaime02, gregorbg and jimmy-earnin