Closed Horion6102 closed 1 year ago
Let me try fix it
enableReinitialize
is probably the issue, every time initialValues
is regenerated it resets the form state.
Just removed enableReinitialize
and it still does the same...
I have simplified some of the code and added live values
and initialValues
to make it easy to see they change together until you check/uncheck another person in the example.
Only thing I discovered is that initialValues
come from a useState
call, without it it works fine but we actually need it.
Edit : here is the link https://codesandbox.io/s/formik-dont-react-forked-jn2vlv?file=/index.js
Bug report
Current Behavior
The issue it's my formik don't detect values change when i use radio buttons.
How to reproduce : if you click on radio button nothing happen, like if nothing change in the
values
, but if click 2 time on the same check box and next to that you change radio button value, you will be able to see the button reload appear, that means formik changesdirty
property to true.Video of issue : https://github.com/jaredpalmer/formik/assets/97897215/dad533ed-d79d-407f-8a7f-d6ea82d9fc2a
Reproducible example
https://codesandbox.io/s/formik-dont-react-r462dq
Suggested solution(s)
We saw that
initialValues
change at same time asvalues
, it seems to be the origin of the problem because then Formik doesn't see any difference between the two objects.Your environment