Field
s re-render twice on each keystroke, based on validation state
#1130
Labels
Field
s re-render twice on each keystroke, based on validation state
#1130
Describe the bug
While trying out the Simple example on the website in the docs, as well as locally, I stumbled upon the following behavior, which I am finding difficult to reason about:
Field
, it renders once on eachonChange
, as long as the data is invalid.Field
renders twice on each keystroke.Please note that:
React.strictMode
, which runs all effects twice, is not used.RenderCount
component andconsole.log
, both of which are in the CSB link below.CSB details:
firstName
andlastName
.firstName
has no validation defined.lastName
has a validation of minimum length: 5.Your minimal, reproducible example
https://codesandbox.io/p/sandbox/great-yonath-3z6vqt
Steps to reproduce
firstName
, observe the render count andconsole.log
s. They should increment by two each time.lastName
. As long as it is invalid and error message is displayed, it will render once on each keystroke. Once length > 5, and input is valid, it will start re-rendering twice.Expected behavior
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
TanStack Form adapter
react-form
TanStack Form version
0.41.3
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: