You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling setFieldValue in two field components based on changes to another field value, the validator of each field component may receive a stale field value.
Expected behavior
The field validator should be called with the latest value.
I think it might be worth mentioning, we first found this issue in Formik 2.1.4, but upgraded to 2.2.9 to see if it still persists. But interestingly, using version 2.2.6 as found in the issue that @jwalton linked works fine!
I also tried 2.2.7 and it's broken there so I suppose it's some change in between.
Version 2.2.5 also works fine, but it's broken for versions <= 2.2.4.
Bug report
Current Behavior
When calling
setFieldValue
in two field components based on changes to another field value, the validator of each field component may receive a stale field value.Expected behavior
The field validator should be called with the latest value.
Reproducible example
https://codesandbox.io/s/green-sun-tekp6b?file=/index.js
Suggested solution(s)
I'm not exactly sure what to do here, as I'm not familiar with Formik internals.
Additional context
Your environment
The text was updated successfully, but these errors were encountered: