What happened?
When using an individual checkbox (non-array) with a default value of true, the resetForm() method will always set the checkbox to the unchecked state.
This seems to be true no matter how the resetForm method is called. E.g. reset inside a <Form> component, resetForm({values:{checkField:true}}, resetForm().
Looking at the resetForm method, it looks like setValues/initialValues (Here or Here) sets the field to true as expected.
But when it calls resetField in applyFieldMutation (Here) it essentially toggles the field back off.
This issue seems to have been introduced in version 4.5.0.
Reproduction steps
- Create a form with one or more single value checkboxes with an initial value of true.
- Reset the form. Either passing a true value or empty (to use old initial values).
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://codepen.io/dusion/pen/zYdooKj
Code of Conduct
What happened?
When using an individual checkbox (non-array) with a default value of true, the
resetForm()method will always set the checkbox to the unchecked state.This seems to be true no matter how the resetForm method is called. E.g. reset inside a
<Form>component,resetForm({values:{checkField:true}},resetForm().Looking at the resetForm method, it looks like setValues/initialValues (Here or Here) sets the field to true as expected.
But when it calls resetField in applyFieldMutation (Here) it essentially toggles the field back off.
This issue seems to have been introduced in version 4.5.0.
Reproduction steps
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://codepen.io/dusion/pen/zYdooKj
Code of Conduct