Describe the bug#
The state property for the form isn't reactive. Here's a StackBlitz that shows the error. I'll explain my example here as well. After calling createForm the state.isDirty property is accessed from the created form inside the markup. I also access the isDirty from the first name field. The error comes in when a field is updated (thus set to dirty), and form.state.isDirty doesn't reflect this change and stays false. I could be missing something here, but at the very least it's confusing
Update:
field.form.state.isDirty reacts as it should. It's included in the StackBlitz example, but not the screen capture
Your minimal, reproducible example#
https://stackblitz.com/edit/tanstack-form-rcp3ph5y?file=src%2FApp.svelte&preset=node
Steps to reproduce#
Type anything in the "First Name" field
Expected behavior#
Form Dirty doesn't update with Field Dirty
How often does this bug happen?#
Every time
Screenshots or Videos#
https://github.com/user-attachments/assets/1ab71899-6a1b-4305-85a2-cdf651a5570f
Platform#
- OS: Windows 11
- Browser: Chrome & Zen (Firefox)
TanStack Form adapter#
svelte-form
TanStack Form version#
1.20.0
The form hook itself is not reactive. If you want to subscribe to form state reactively, you can check the Reactivity section in the Basic Concepts docs
The reason why the state worked in the field callback is because it runs on every change, which will affect the
isDirtystate that is being read.