Subscribe on changes!

merge props from global mixin and extended, it will affect when extended component might be cache wrong props

avatar
Apr 3rd 2023

Vue version

3.2.47

Link to minimal reproduction

https://codepen.io/gcaaa31928/pen/xxavOMK

Steps to reproduce

  const props = {
    globalProp: {
      type: String,
      default: defaultProp
    }
  }
  const globalMixin = {
    props
  }
  const Comp = {
    render(this: any) {
      renderProxy = this
      return h('div', ['Comp', this.globalProp])
    }
  }
  const ExtendedComp = {
    extends: Comp,
    render(this: any) {
      extendedRenderProxy = this
      return h('div', ['ExtendedComp', this.globalProp])
    }
  }

  const app = createApp(
    {
      render: () => [h(ExtendedComp), h(Comp)]
    },
    {}
  )
  app.mixin(globalMixin)

and Comp will cache wrong props, which is lack of global prop

What is expected?

codepen example should be render globalProp

What is actually happening?

cache wrong prop when component had been extended

System Info

No response

Any additional comments?

I have already submitted a proposed solution for the issue in the form of a pull request at https://github.com/vuejs/core/pull/7998. I kindly invite vue team members to review this PR to ensure its effectiveness and alignment with the project requirements. Your feedback and suggestions are greatly appreciated.

avatar
Apr 11th 2023

@sodatea can you have a look on this issue. Just remind me if it need to have extra information