carbon-design-system / carbon-components-vue

Vue implementation of the Carbon Design System
http://vue.carbondesignsystem.com
Apache License 2.0
606 stars 178 forks source link

[CvModal]: Uncaught TypeError: this.$refs.primary is undefined when using inside a slot #1029

Open Thomasan1999 opened 3 years ago

Thomasan1999 commented 3 years ago

Detailed description

When I use CvModal component inside a slot, I get the Uncaught TypeError: this.$refs.primary is undefined in cv-modal.vue:189 in the onShown method. I think it is related to the slot content being rerendered and in the beforeUpdate hook the component slots being undefined. So the hasPrimary property is set to false in the checkSlots method and the primary button slot is not rendered in the template afterwards.

Steps to reproduce the issue

  1. Create a simple component with a slot and a property which will change and will be binded to the slot:
    
    <template>
    <div>
        <slot v-bind="{loading}"/>
    </div>
    </template>

2. Place CvModal inside the slot: