final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.38k stars 480 forks source link

Overriding reset behavior does not seems to work for checkbox and radio buttons #930

Open utkarsh22garg opened 3 years ago

utkarsh22garg commented 3 years ago

Are you submitting a bug report or a feature request?

I am submitting a bug report.

What is the current behavior?

I have overridden the reset button behavior by overriding onClick of reset button. But when I click reset, all values are removed at first, but when you click on checkbox item/radio item, previous values come up.

What is the expected behavior?

Expected behavior should be that on clicking reset button, only console logs should be made (since I have overridden the click behavior) and even after reset checkbox and radio button should be showing all selected values.

Sandbox Link

https://codesandbox.io/s/react-final-form-list-of-checkboxes-and-radio-buttons-forked-6voxz?file=/src/index.js

What's your environment?

Please let me know in case I am missing something.

utkarsh22garg commented 3 years ago

Hi @erikras, can you please look at this?

callmeberzerker commented 3 years ago

reset doesn't work with react-final-form quick glance over existing issues - the features is completely missing. You can explicitly reset the form using `<Button onClick={() => { form.reset(); someComplexLogicFunc(); } } />