TanStack / form

🤖 Powerful and type-safe form state management for the web. TS/JS, React Form, Solid Form, Lit Form and Vue Form.

Home Page:https://tanstack.com/form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unmounting a field does not update the form

Christian24 opened this issue · comments

Describe the bug

Hi,

I just noticed a bug unmounting a field: the state and fieldInfo of the field is preserved in the form even after unmounting it.

To illustrate I added some expects to the unmount test:

     // Field should have been removed from the form as well
    expect(form.state.values.name).toBeUndefined()
    expect(form.state.fieldMeta.name).toBeUndefined()

These last assertions fail at the moment.

Your minimal, reproducible example

#501

Steps to reproduce

  1. Run the tests
  2. they fail

Expected behavior

Tests pass

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • Jest

Tanstack Form adapter

None

TanStack Form version

latest

TypeScript version

No response

Additional context

No response

@crutchcorn can you please reopen this? seems it is not fully fixed.