form icon indicating copy to clipboard operation
form copied to clipboard

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

Open nmai601 opened this issue 4 months ago • 1 comments

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

nmai601 avatar Oct 22 '25 20:10 nmai601

https://github.com/TanStack/form/pull/1809

May be related to

kusiewicz avatar Oct 23 '25 15:10 kusiewicz