Skip to content

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

@nmai601

Description

@nmai601

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: #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions