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

Unmounted fields error messages are not removed #3384

Closed
logaretm opened this issue Jul 8, 2021 · 0 comments · Fixed by #3385
Closed

Unmounted fields error messages are not removed #3384

logaretm opened this issue Jul 8, 2021 · 0 comments · Fixed by #3385
Labels
🐛 bug Unintended behavior

Comments

@logaretm
Copy link
Owner

logaretm commented Jul 8, 2021

Versions

  • vee-validate: 4.4+
  • vue: 3.x

Describe the bug

Given a conditional field in a form that has a validation error message, when that field is unmounted due to v-for or v-if, that field error stays behind until the next full-form validation (pre-submit).

This only happens when fields have their own validation rules (field-level), this issue doesn't happen with form-level validation schemas.

Note that this only happens if you read the error value from useForm or Form.

To reproduce

Steps to reproduce the behavior:

  1. Create a conditional field with v-if
  2. Trigger a validation error for that field
  3. Toggle the condition to false
  4. Notice the error message stays behind

Expected behavior

The field error should be removed as long the field has no other instances (checkbox group, or radio)

Demo link

https://codesandbox.io/s/fvlvee-validate-form-error-handling-5m4rt?file=/src/App.vue

Additional context

This issue was reported in formvuelate/formvuelate#210

For those interested, this issue occurs in vee-validate 4.4+ because of the internal changes to the error object which is no longer a "computed" object, when it was computed it used to take care of itself but now we should have a clean step for it.

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

Successfully merging a pull request may close this issue.

1 participant