form
form copied to clipboard
Sync field meta with third party validation via useEffect
Describe the bug
Using a third party lib like Remix has some a11y features built in an its own Form validation that leverages native web API
It should be possible to synchronise the validity state from Remix into tanstack form so that things like submit buttons can react to the invalid state of a field
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-wvp1dlya?file=src%2Findex.tsx
Steps to reproduce
- Type a value in the input
- Blur the input
- Clear the value from the input
- See that Remix has update to show the error message and inspect the console to see the
useEffecthas triggered which issued an update to the tanstack form instance throughuseFieldContext - See the debug output in the
pretag of theform'sstate for this field hasn't been updated
Expected behavior
The form's state should reflect the new value issued by the useEffect
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- macOS
- Chrome/Brave/etc...
It's reproduced in the stackblitz
TanStack Form adapter
None
TanStack Form version
1.9.0
TypeScript version
5.8.3
Additional context
No response