Open aczekajski opened 5 years ago
I have found a problem similar to this. I'm changing a field's validate function (to make it required/not required) and the old validation remained after changing the validate function, the field had to get focus before clearing out the old errors. I can confirm that I was also changing the key as per the documentation.
@highflying Have you tried to reach something like this? https://codesandbox.io/s/agitated-david-qzyq98?file=/src/App.tsx
Are you submitting a bug report or a feature request?
Bug report or request for making clear in docs that doing the following is forbidden
What is the current behavior?
Field
with the samename
more then once and specify some validation on one of themvalidate
prop on itOn the following example you can mount and unmount
Field
withvalidate
on it by using checkbox. Below theerrors
,valid
andvalues
of form are shown. https://codesandbox.io/embed/react-final-form-unmounting-validation-bug-doocvWhat is the expected behavior?
Unmounting
Field
should also clear validation errors previously produced byvalidate
on this Field.Additional info: desired behaviour can be observed if you unmount all occurences of
Field
with the samename
.Sandbox Link
https://codesandbox.io/embed/react-final-form-unmounting-validation-bug-doocv
What's your environment?
As seen in CodeSandbox example: "final-form": "4.8.15", "react": "16.9.0", "react-dom": "16.9.0", "react-final-form": "6.3.0"
Run on Chrome 74, Windows.
Other information
Desired behaviour can be observed if you unmount all occurences of
Field
with the samename
.