final-form / final-form

🏁 Framework agnostic, high performance, subscription-based form state management
https://final-form.org
Other
3k stars 213 forks source link

resetFiled #370

Open dgalyan opened 4 years ago

dgalyan commented 4 years ago

Hi,

I am using resetFieldState function of useForm API to reset my field to the initial state. Unfortunately, it only resets a few fields and not reset the entire field object. The error state and invalid state are not updated to their default state i.e. error should be undefined and invalid should have false value. However, in my application, I want to update these fields to their default value. How can this functionality be achieved?

From what I understand, it only resets InternalFieldState and not InternalFormState.Whereas, the errors field is part of InternalFormState. So, how can I update errors state for given field?

Thanks

ViktorAksionov commented 3 years ago

use restart to reset whole form fields and fields states

mihanizm56 commented 3 years ago

I'm in the same same situation - docs said Resets all of a field's flags (e.g. touched, visited, etc.) to their initial state. But not all fields in field-object are updated use version "final-form": "4.20.2", "react-final-form": "6.5.3",

gertdreyer commented 1 year ago

@dgalyan @mihanizm56 - Please provide a CodeSandbox to demonstrate the bug