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

Vue does not correctly dedupe global mixin, global mixined lifecycle hook be called twice #9198

Closed
hikerpig opened this issue Dec 13, 2018 · 1 comment

Comments

@hikerpig
Copy link
Contributor

Version

2.5.21

Reproduction link

https://codepen.io/hikerpig/pen/dwYEej

Steps to reproduce

Goto the minimal reproduction link

Or simply add this to test/unit/features/options/mixins.spec.js

  it('should not mix global mixined lifecycle hook twice', () => {
    const spy = jasmine.createSpy('global mixed in lifecycle hook')
    Vue.mixin({
      created() {
        spy()
      }
    })

    const mixin = Vue.extend({})

    const Child = Vue.extend({
      mixins: [mixin],
      created() {}
    })

    const vm = new Child()

    expect(spy.calls.count()).toBe(1)
  })

What is expected?

spy to be called once

What is actually happening?

spy is called twice


When using vue-class-component , it's easy to pass not-plain-object to Vue.extends mixins

I've added a similar issue in vuejs/vue-class-component#291 , and it is still not fixed

@yyx990803
Copy link
Member

closed via #9199 - thanks for fixing your own issue! 👍

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

3 participants