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

$validator.validateAll() started to resolve positive all the time in 2.0.0-rc.12 #734

Closed
Gotterbild opened this issue Aug 16, 2017 · 2 comments
Labels
❔ question More of an inquiry than an issue

Comments

@Gotterbild
Copy link

Gotterbild commented Aug 16, 2017

Versions:

  • VueJs: 2.4.2
  • Vee-Validate: 2.0.0-rc.12

Description:

Everything worked with 2.0.0-rc.3

After upgrading to 2.0.0-rc.12 $validator.validateAll() started to resolve positive all the time.

Expected behavior and how it works with 2.0.0-rc.3:

  1. I click a button
  2. $validator.validateAll() ignores then section and goes to catch section.
  3. Validation errors appear for invalid fields (through :class="{show: errors.has('password:required')}")

How it works with 2.0.0-rc.12:

  1. I click a button
  2. Validation errors appear. So, validator seems to validate, BUT
  3. $validator.validateAll() fires then section and never runs catch section

When I downgrade to 2.0.0-rc.3 app works as expected.

Steps To Reproduce:

Run the fiddle: https://jsfiddle.net/v4ejau4e/2/

@Gotterbild Gotterbild changed the title $validator.validateAll() started to return true all the time in 2.0.0-rc.12 $validator.validateAll() started to resolve positive all the time in 2.0.0-rc.12 Aug 16, 2017
@logaretm
Copy link
Owner

logaretm commented Aug 16, 2017

You should read the release notes, the validator no longer throws an exception when validation fails, because technically it is an expected result. this is discussed here #507

Basically it hides the real reason behind the rejection, which could include an app error not just the validator error. Now the validator returns the result as a boolean in the then callback.

page.$validator.validateAll()
  .then(function (result) {
    if (result) {
      // all good
    } else {
      // validation failed.
    }
  })
  .catch(function (error) {
    // something serious has went wrong, not a validation error.
});

I've updated the fiddle:

https://jsfiddle.net/logaretm/v4ejau4e/3/

I'm aware that such breaking changes should respect semver more, but that is why we are still at rc so we can improve the library before getting the first release, which then would respect semver more. Sorry about that.

@logaretm logaretm added the ❔ question More of an inquiry than an issue label Aug 16, 2017
@Gotterbild
Copy link
Author

Thanks! Sorry, but I didn't read the release notes as you just can't check out release notes of every lib you have after you run npm install, especially if you have 50+ libs :)

Usually first idea you have is that it is a bug, not a feature :)

Will read release notes next time.

Thanks for great lib!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ question More of an inquiry than an issue
Projects
None yet
Development

No branches or pull requests

2 participants