vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.46k stars 33.64k forks source link

Duplicate presence of slot error when using children through a scoped slot. #9082

Closed executivesplace closed 5 years ago

executivesplace commented 5 years ago

Version

2.5.17

Reproduction link

https://jsfiddle.net/jsotron5000/eywraw8t/464522/

Steps to reproduce

Run the JSFiddle and open up dev tools. You will see the Vue warning about duplicate default slots even though there is only one slot in the template.

What is expected?

No warning when using child components slotted into a renderless component.

What is actually happening?

A warning is displayed saying there are duplicate default slots when there is only one.


Here is another JSFiddle with a use case where this bug would occur:

https://jsfiddle.net/jsotron5000/eywraw8t/464242/

It is a renderless tabs component that works with another component (TabItem) which can be passed in through a slot.

The TabContainer component looks at the TabItem components and relays them to the parent component through a scoped slot.

The warning only displays when doing anything with the child vnodes inside the render function.

If you replace the children prop in the JSFiddle with just a hard coded array there is no warning.

posva commented 5 years ago

Duplicate of #8546