Field meta out of date when setting object field
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
Let's say you have a field { a: { b: 0 } }.
If that field has validation on a.b that says it must be greater than 0, you will have field meta error.
If you programmatically set a to { b: 1 }, the field meta error will not go away.
Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-7o8e4iwp?file=src%2FApp.tsx
Steps to reproduce
- Click on button 1
- Click on button 2 (at this point the field meta errors should be gone and the form should be valid)
- Click on button 3 (now the field meta errors are gone, only be explicitly setting all nested fields)
Expected behavior
In my simple example above, if I set a to { b: 1 }, field meta errors should be gone.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
- macos
- chrome
TanStack Form adapter
None
TanStack Form version
1.28.6
TypeScript version
No response
Additional context
This issue I submitted is duplicate https://github.com/TanStack/form/issues/2069
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 minimal reproduction in src/App.tsx from the linked StackBlitz and compare the duplicate issue 2069. Reproduce the sequence of buttons setting a and inspect when nested field meta errors and form validity update; done means setting a to { b: 1 } clears the related errors and marks the form valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100