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
Workaround if anyone runs into this same issue, set the field value in a useEffect (or you can do it where you calculate the computed value) with "dontUpdateMeta" set to true. This is how it appears the default value is normally set internally.
Describe the bug
When using the defaultValue prop on form field, if the value is updated, the default doesn't update when the prop is updated.
I could understand maybe if this was intentional behavior, but this isn't how the defaultValues prop on the form hook works, those can be updated.
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-r858qffw?file=src%2Findex.tsx
Steps to reproduce
Open the reproduction above. Notice the setTimeout in the useEffect. The default value does not update to "Updated" after one second.
Expected behavior
The form field value should update to "Updated" after one second.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
TanStack Form adapter
react-form
TanStack Form version
0.42.0
TypeScript version
5.1.0
Additional context
I would like to use the default value feature to derive the value of a field from the value of others, but this makes it impossible to do so.
The text was updated successfully, but these errors were encountered: