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] useFieldArray's update() method validates entire form, including untouched fields #3981

Closed
4 of 5 tasks
acicero93 opened this issue Oct 31, 2022 · 1 comment
Closed
4 of 5 tasks
Labels
🐛 bug Unintended behavior

Comments

@acicero93
Copy link

acicero93 commented Oct 31, 2022

What happened?

When calling the update() method provided by useFieldArray, form validation is triggered and displays errors for all fields, even those that haven't been touched.

Reproduction steps

  1. Create a form context with useForm
  2. Add a yup schema to the form with a few required fields, and an array field
  3. Create a custom text input component that uses useField. These fields should be required by yup validation
  4. Initialize the array field with useFieldArray
  5. Call the update method provided by useFieldArray and observe the other required fields fail validation, even though they haven't been touched yet.

NOTE
This seems to be an issue starting since v4.7.1


Reproduction Link Below

Simply click the "Update Array Field" button to see validation triggered on untouched fields.

Reproduction Stackblitz

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://stackblitz.com/edit/vee-validate-v4-array-fields-1ljfl1?file=src%2FApp.vue

Code of Conduct

@logaretm logaretm added the 🐛 bug Unintended behavior label Nov 1, 2022
@logaretm
Copy link
Owner

logaretm commented Nov 2, 2022

Looks like it is caused by #3982 where the validate method not respecting the mode when setting the validated flag.

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

No branches or pull requests

2 participants