Default value on field is overwriting default value on useAppForm
Describe the bug
As mentioned in the title if you have a default value on a form.AppField this overwites the value coming from useAppForm for async loading. Hierarchically these should be overwritten from parent.
Prio
useAppFormdefaultValueformOptionsdefaultValueform.AppFielddefaultValue
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/frosty-james-mwktlf
Steps to reproduce
- Create a
useAppFormwithdefaultValue - Declare an empty string or
countryCodefor a field as default value if no value exists - Have
defaultValuefrom base - Expect
defaultValuechange on root to overwrite fieldDefaultValue
Expected behavior
Expect defaultValue change on root to overwrite fieldDefaultValue
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Windows Chrome 136.0.7103.114
TanStack Form adapter
None
TanStack Form version
^1.11.1
TypeScript version
^5.8.3
Additional context
No response
The field is more specific. Can you elaborate on why the form should take priority?
In my use case the source of truth comes from the server so any default values (like a default countryCode on a country code dropdown) does not change the default value.
How can i have field specific default values and have a default value set via the form? My fields are generic using the composition useAppForm and I would like a defaultValue on countryCode.
To return the question when would you want a form controller to not overwrite the default value of the field? Whats the use case here?
More generically when does a child ever overwrite the parent state?