Open
Description
Describe the bug
I want to disable the submit button after the submission. I compare options.defaultValues
and values
from the store to determine whether they are equal. However, the next render after submission contains stale options. This happens likely because of the useIsomorphicLayoutEffect
that updates the options here. I wonder maybe the formApi.update
can be called during the render
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/elated-brahmagupta-sj6mvk
Steps to reproduce
- Type "Johny" in the input
- Click the submit button
- Click the submit button again
Expected behavior
As a user, I expect that the submit button is disabled after the first click, but it becomes disabled only after the second click
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Windows
- Browser: Chrome
TanStack Form adapter
react-form
TanStack Form version
v0.39.0
TypeScript version
v4.4.4
Additional context
If the useQuery is replaced with a useState then everything works as expected.