Open antoniomadonna opened 4 years ago
You can make your deep equal, for example with lodash.isequal in initialValuesEqual
.
But yes it's a bug
I too have had this happen when using an object as the value with nested values.
Any updates here?
Thanks @simstefani for making us aware of initialValuesEqual
.
An alternative solution to the deep equal (depending on the use case) would be to set initialValuesEqual={() => true}
. The form can then be reset with a key prop or via formApi.restart(initialValues?: InitialFormValues) if needed.
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
When the form has deep (with nested properties) initialValues and re-renders it will reset all the form state.
What is the expected behavior?
It should not reset entered values
Sandbox Link
https://codesandbox.io/s/react-final-form-nested-values-bug-sn0mc
What's your environment?
"react-final-form": "^6.3.5", "final-form": "^4.18.7",
Other information