Skip to content

using Astro.slots.render breaks children hydration #8222

@y-nk

Description

@y-nk

Astro info

Astro version            v2.10.14
Package manager          npm
Platform                 linux
Architecture             x64
Adapter                  Couldn't determine.
Integrations             @astrojs/react

What browser are you using?

stackblitz

Describe the Bug

In a component, make use of Astro.slots.render to pre-render a slot (no matter which).
If a child of this slot has a client directive, it will be ignored.

What's the expected result?

Hydration should happen normally

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-wkjve2?file=src/pages/index.astro,src/components/Working.astro,src/components/NotWorking.astro

Usecase

I'm making a carousel. The carousel has a slot[name=slides] to collect all the slides of the carousel, for which i'd like to compute the children.length so that it doesn't have to come from userland. The length is used to generate pagination ui.

Participation

  • I am willing to submit a pull request for this issue ...but i don't have much time at the moment. i'll be available around september.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)feat: renderingRelated to prop serialization, html escaping, and framework components (scope)requires refactorBug, may take longer as fixing either requires refactors, breaking changes, or considering tradeoffs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions