removeFieldValue keeps data from subfields when used with form.AppField - unable to delete last row in AgGrid
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 am using Tanstack Form with AgGrid. When calling removeFieldValue, some subfields persist even after the parent field is removed. I suspect it has something to do with form.AppField. I noticed this problem when trying to delete the last row in AgGrid. When attempting to save the form after deleting the last row, the form is invalid and cannot be submitted.
Similar to this problem here: https://github.com/TanStack/form/issues/1178
Your minimal, reproducible example
https://stackblitz.com/edit/bolt-vite-react-xodftmth?file=src%2FApp.tsx
Steps to reproduce
- Enter stackblitz
- Click Delete
- Click Submit
- Error is displayed because form is invalid
- Checking dev tools console logs, you can see that after the delete, the age field is left in fieldMeta
Expected behavior
I expect subfields to also be removed when removing the parent field.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Windows 10
Chrome 141.0.7390.78
TanStack Form adapter
None
TanStack Form version
v1.23.7
TypeScript version
v5.9.2
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 trace removeFieldValue when used with form.AppField, focusing on the fieldMeta entry that remains for age after deletion. Confirm the behavior by deleting the last row and submitting; done means the parent and its subfields are removed and the form can submit without the stale validation error.
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