You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
form.reset during onSubmit ignores new default values #1681
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.
It looks like in v1, the check for new default values passed because
You create a new object on every render, which means that TanStack Form assumed new async data came in
Your newly created object is different from the resetted values, which means that TanStack Form assumed that your default values were stale
It therefore updated the default values. isDirty was just an immediate way to cause a rerender of the component, but anything would have done it, like unrelated useStates.
In v2, we have an equality check for both new default values as well as comparing your current state with the incoming values. This means that referential changes don't matter, but value changes do.
Activity
romulovalez commentedon Aug 18, 2025
+1, a workaround for now is to
setTimeout(() => form.reset());djordje-st commentedon Aug 19, 2025
Unfortunately that doesn't work for me either
dragonautdev commentedon Aug 19, 2025
@romulovalez @djordje-st The setTimeout strategy works, but the amount of time you need to wait varies.
when we discovered the issue, I had to set a timeout of up to 500ms for it to work.
LeCarbonator commentedon Aug 11, 2026
It looks like in v1, the check for new default values passed because
It therefore updated the default values.
isDirtywas just an immediate way to cause a rerender of the component, but anything would have done it, like unrelateduseStates.In v2, we have an equality check for both new default values as well as comparing your current state with the incoming values. This means that referential changes don't matter, but value changes do.
20260811-1840-38.5806507.mp4