After update to version 2.0.0-rc.14 I got the error on a form using scope:
Error in directive validate unbind hook: "TypeError: Cannot convert undefined or null to object"
I have two forms: the first, inside a v-if as the default option, is a login form with email and password fields. The second, inside the v-else, is a password reset form, with the email field only. Each one has it's own scope and they call different methods for handling the submit.
TypeError: Cannot convert undefined or null to object
at Validator.detach (vee-validate.js?d4ab:3391)
at unbind (vee-validate.js?d4ab:3824)
at callHook$1 (vue.common.js?e881:5752)
at _update (vue.common.js?e881:5716)
at updateDirectives (vue.common.js?e881:5658)
at Array.unbindDirectives (vue.common.js?e881:5652)
at invokeDestroyHook (vue.common.js?e881:5277)
at invokeDestroyHook (vue.common.js?e881:5281)
at invokeDestroyHook (vue.common.js?e881:5281)
at invokeDestroyHook (vue.common.js?e881:5281)
The form I've submited had the scope 'login'.
The function where I've found the error is Validator.prototype.detach, line 3382 in the vee-validate.js file. The object flags does not contains the $login array, hence the error. The solution I've found was change this:
if (field.scope) {
delete flags[("$" + (field.scope))][field.name];
} else {
delete flags[field.name];
}
to this:
if (field.scope != undefined && flags[("$" + (field.scope))] != undefined) {
delete flags[("$" + (field.scope))][field.name];
} else {
delete flags[field.name];
}
this was resolved and it should be up with the next release, duplicate of #788
Life saver
Most helpful comment
this was resolved and it should be up with the next release, duplicate of #788