vuejs/vue

function setCurrentInstance(vm) crashes when vm._scope is undefined

blinkingmatt opened this issue · 2 comments

Vue version

2.7

Link to minimal reproduction

http://

Steps to reproduce

var app = new Vue( 
    {
            mixins: [ any_mixin ],
            el: '#app',
            ...
    }
)
    

What is expected?

Vue application will be created

What is actually happening?

Creation crashes in function setCurrentInstance(vm) since currentInstance._scope is undefined for callHook$1(vm, 'created');

System Info

No response

Any additional comments?

Solution:

function setCurrentInstance(vm) {
      if (vm === void 0) { vm = null; }
      if (!vm)
          currentInstance && currentInstance._scope && currentInstance._scope.off();
      currentInstance = vm;
      vm && vm._scope && vm._scope.on();
  }

Probably a variable name clash in a mixin (this._scope in "created"-hook).

Perhaps internal undocumented vm instance variables should be prefixed (e.g. "_vm_scope").
Otherwise the component developer can do that in his code as well ...