A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/issues/9198 below:

Vue does not correctly dedupe global mixin, global mixined lifecycle hook be called twice · Issue #9198 · vuejs/vue · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4