The Wayback Machine - https://web.archive.org/web/20220718112358/https://github.com/vuejs/vue/issues/12245
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 2.x reactivity broken when using nested named slots with the same name #12245

Open
enekesabel opened this issue Aug 27, 2021 · 2 comments · May be fixed by #12265
Open

Vue 2.x reactivity broken when using nested named slots with the same name #12245

enekesabel opened this issue Aug 27, 2021 · 2 comments · May be fixed by #12265

Comments

@enekesabel
Copy link

@enekesabel enekesabel commented Aug 27, 2021

Version

2.6.11

Reproduction link

codesandbox.io

Steps to reproduce

Click the "increment" button

What is expected?

the counter in the #default slot of the Parent should increment as well, when pressing the button

What is actually happening?

the counter in the #default slot of the Parent does not update


I have a Parent component, which has a default slot, and I'd like to display some stuff in the default slot of that component.
The Parent component contains two child components both of them have a named slot called "content". These child components are nested in the Parent, the first renders the second in its #content slot, and the second renders the Parent's #default slot in its #content slot.

Observation:
The reactivity inside the Parent's default slot is broken as long as the two nested child components' slot names match. (If we reused one of the WithContentSlot components twice, it would give the same result).

In my real project I'm working with a bunch of renderless components which expose some of their logic via slotProps on their #default slot, if I nest any of them, then I run into this issue.

@JuniorTour
Copy link

@JuniorTour JuniorTour commented Aug 29, 2021

This issue seems to be relate to #12232.

Both of them use named nested scoped slot.

@liyongning
Copy link

@liyongning liyongning commented Sep 30, 2021

This appears to be a bug with the v-slot instruction shorthand (#xx), which can be fixed using slot= "xx" syntax,i.e:
<template #content></template> changed to <template slot="content"></template>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants