Breaking Changes 💥
As pointed out here #507 by @rstuart85 While the catch behavior was suitable for people who always intended to have a catch handler, but was verbose for the people who didn't. And also it caused other issues or exceptions to be reported as a validation error which isn't the case.
The validateAll
, validate
and validateScopes
has been changed to return a Promise that will always resolve regardless of the validation status, the resolved value will be either true
or false
depending on the validation status, which takes us back to pre beta.18
.
So the catch handler will now run only when something critical has gone wrong, like a custom validator failure, or actual bugs.
this.$validator.validateAll().then(result => {
if (! result) {
// handle input errors.
return;
}
// submit the form or whatever.
}).catch(() => {
// this is an actual app logic error.
});
Fixed 🐛
-
Error Bag uses splicing instead of re-assignment to reduce the bugs resulted from re-rendering the DOM which caused some inputs to be unresponsive to user input, thanks @ThomHurks for #569
-
Fix issue with flags not refreshed after a data change on custom components, thanks @Toilal for #580
-
Fix validator API method
flag
not setting flags for fields with dots in their name correctly. #567 -
Fix an issue with computed properties validation where the validator will validate the input value instead of the actual computed value #423.
-
Fixed an issue where unwatchable models with lazy modifier would lock up the input from being used, fixed by listening using the
change
listener to be consistent with thelazy
modifier behavior. -
Fix context and getter pairs generation for bound fields and custom components. #521
-
Use the
bind
hook to setup the validation on the field, previously it was usinginserted
which fixes binding inside transitions or templates. #496 -
Fix debounced validation running immediately at all times. #519
Enhancements ✨
-
Type definitions for the
pending
and therequired
flags have been added thanks to @agentschmitt for #571 -
Added a new
validated
flag which reflects the validation status of the input, by default it is false until the field has been validated at least once, previously it was being achieved by checking thevalid
andinvalid
properties if they are equal tonull
or not. -
The
ValidatorException
now properly extends the nativeError
class which means better error reporting and stack traces will be reported. -
Inputs that are
disabled
will now be ignored during validation or using the manual API, components can similarly have adisabled
attribute which will behave in the same way. #245 -
Extending the validator with custom rules will no longer throw an exception if the rule already exists, it will overwrite it silently.
-
before
andafter
messages have been adjusted to include the inclusion case. other locales might need your help. -
The ES6 module version has been renamed to
vee-validate.esm.js
Thank you so much for the locale maintainers for the nice PRs submitted this month.