Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.5] Individual checkboxes ignore initial value on formReset() #3551

Closed
2 of 5 tasks
gurudusty opened this issue Oct 21, 2021 · 1 comment
Closed
2 of 5 tasks

[v4.5] Individual checkboxes ignore initial value on formReset() #3551

gurudusty opened this issue Oct 21, 2021 · 1 comment

Comments

@gurudusty
Copy link

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

  1. Create a form with one or more single value checkboxes with an initial value of true.
  2. 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?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://codepen.io/dusion/pen/zYdooKj

Code of Conduct

@gurudusty gurudusty changed the title [v4] Individual checkboxes ignore initial value on formReset() [v4.5] Individual checkboxes ignore initial value on formReset() Oct 21, 2021
@logaretm
Copy link
Owner

logaretm commented Oct 21, 2021

Thank you for reporting this and for the investigation I will take another look and resolve it on the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants