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

Validation is invalid on page load after updating to 4.4.0 #3342

Closed
ahoiroman opened this issue Jun 4, 2021 · 6 comments
Closed

Validation is invalid on page load after updating to 4.4.0 #3342

ahoiroman opened this issue Jun 4, 2021 · 6 comments
Labels
🐛 bug Unintended behavior

Comments

@ahoiroman
Copy link

ahoiroman commented Jun 4, 2021

Versions

  • vee-validate: 4.4.0

Describe the bug

I created different input elements that are making use of vee-validate. On page-load the inputs are invalid, even though the schema is met.

This problem is not appearing in vee-validate < 4.4.0.

Demo: https://codesandbox.io/s/thirsty-sea-3mhf1?file=/src/App.vue

As you can see here, I got a v-if statement, that I am using in my app too, as the form-items are shown after some stuff has been loaded. In this demo, the setTimeout()-function is faking this behavior.

@ahoiroman
Copy link
Author

The problems seems to be the v-if - using v-show this is not happening (although I can not use it in my case)

@logaretm logaretm added the 🐛 bug Unintended behavior label Jun 5, 2021
@logaretm
Copy link
Owner

logaretm commented Jun 5, 2021

Thanks for reporting this, this is caused by the schema strictness in v4.4 where previously vee-validate ignored any errors for non-existent fields. in 4.4 it doesn't do that anymore and when a field is rendered it inherits the previously generated errors for it as initial errors.

While I'm not sure if this is the desired behavior or not, it defiantly doesn't reflect the correct state of the field which should be valid without error messages in your example. But this conflicts with initialErrors. If someone sets the initial errors, they should be respected which is what essentially your case is, vee-validate thinks this is an initial error.

Will think of a way to differentiate the user-set initial errors from the others.

@ahoiroman
Copy link
Author

Thanks. Can't wait to see this in a patch-release. Thanks for your fast response.

@logaretm
Copy link
Owner

logaretm commented Jun 5, 2021

Should be tagged in 4.4.4, thanks for reporting this.

@ahoiroman
Copy link
Author

Not solved.

@paulorodrigues-mb
Copy link

I'm having exactly the same behavior on v4.4.5

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

3 participants