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

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

Closed
blinkingmatt opened this issue Feb 1, 2024 · 2 comments
Closed

Comments

@blinkingmatt
Copy link

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();
  }
@LinusBorg LinusBorg transferred this issue from vuejs/core Feb 1, 2024
@blinkingmatt
Copy link
Author

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

@blinkingmatt
Copy link
Author

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 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants