TanStack / TanStack/form

removeFieldValue keeps data from subfields when used with form.AppField - unable to delete last row in AgGrid

Open
#1,820 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v1 v2: needs investigation
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
  1. Enter stackblitz
  2. Click Delete
  3. Click Submit
  4. Error is displayed because form is invalid
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.