Reset form does not work as expected in combination with `useStore`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.7k
- Forks
- 682
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 7
Description
Describe the bug
I realize there are some related issues (https://github.com/TanStack/form/issues/1490) but I think there are still some bugs somewhere.
It seems like after resetting to new values, subscribing to the state of those new values reverts them to the default values.
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-x8aebugd?file=src%2FApp.tsx
Steps to reproduce
- go to sandbox
- observe
x === 1anddate === new Date()in the input fields. this is incorrect. - comment out line 12 and comment in line 13
- observe
x === 5anddate === new Date(2025, 0, 1)in the input fields. this is correct.
Expected behavior
x === 5 and date === new Date(2025, 0, 1)
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- macOS
- brave
- 1.82
TanStack Form adapter
react-form
TanStack Form version
v1.19.5
TypeScript version
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and compare the behavior with line 12 enabled versus line 13 enabled. Trace how resetting to new values interacts with the useStore subscription, then verify that the inputs retain x === 5 and date === new Date(2025, 0, 1) after the reset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100