-
-
Notifications
You must be signed in to change notification settings - Fork 533
Open
Description
Describe the bug
When calling form.deleteField('fieldName')
on a field that has a defaultValue
defined, the field is successfully removed from form.state.values
. However, after React re-renders, the field automatically reappears with its defaultValue
, making it impossible to truly delete fields with default values.
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-cnn3izz6?file=src%2Fapp.tsx
Steps to reproduce
- Go to the
StackBlitz
example - Click
remove fullname
button - Look on live state
Expected behavior
After calling form.deleteField('fieldName')
, the field should:
- Be permanently removed from
form.state.values
- Stay removed even after React re-renders
- Not be restored by any internal lifecycle methods
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
everywhere
TanStack Form adapter
None
TanStack Form version
1.23.4
TypeScript version
^5
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels