Vee-validate: TypeError: Cannot read property 'name' of undefined when destroy a component that contains validationprovider

Created on 6 Sep 2019  路  3Comments  路  Source: logaretm/vee-validate

Versions

  • vee-validate: 3.0.3
  • vue: 2.6.10

Describe the bug
While destroying a component containing the validation provider (I.E. a modal) removeProvider is called and provider.name is causing "TypeError: Cannot read property 'name' of undefined", since provider is not defined.

https://github.com/logaretm/vee-validate/blob/7a4b81848627ec5f3c58b0730976ee995b6aa137/src/components/Observer.ts#L237

A check on the provider definition should be done before deleting the reference.

馃悰 bug

Most helpful comment

I played around with various tests and there could be a case where the provider would be removed twice if you are using the persist option or keep-alive component.

I have patched it for now.

All 3 comments

I think you mean 3.0.4?

I think this is because of 7a4b81848627ec5f3c58b0730976ee995b6aa137 however the check should be redundant as the provider should always exist. Could you provide a sample so I better understand what is going on?

Hi @logaretm,

thanks for the quick reply. :)
npm is pulling 3.0.3, (at least that's what I read on the package-lock.json, I might have some issue with it.

For some reason, removeProvider gets called twice, and the first time the provider object is there, the second it comes undefined.

I will provide an example as soon as possible.

I played around with various tests and there could be a case where the provider would be removed twice if you are using the persist option or keep-alive component.

I have patched it for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

the94air picture the94air  路  3Comments

yyyuuu777 picture yyyuuu777  路  3Comments

Etheryte picture Etheryte  路  3Comments

biapar picture biapar  路  3Comments

DanielPe05 picture DanielPe05  路  3Comments