Skip to content

Unable to hydrate components dynamically using Astro.slots.render inside mdx. #14518

@Hugos68

Description

@Hugos68

Astro Info

Astro                    v5.14.4
Node                     v22.20.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte (v7.2.0)
                         @astrojs/react (v4.4.0)
                         @astrojs/mdx (v4.3.7)

If this issue only occurs in one browser, which browser is a problem?

Not relevant

Describe the Bug

Using Astro.slots.render inside a component that is rendered inside MDX results in broken hydration when using multiple frameworks.

What's the expected result?

Both should be able to hydrate without any problems.

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/Hugos68/astro-inconsistent-hydration-behaviour

Steps:

  1. Open the root page, will redirect to /bar/mdx
  2. View the 4 links, each link will bring you to a "environment"
  3. Each page shows wether the FrameworkComponent component (in this case Svelte, but the same happens with other frameworks) (with client:load) hydrated correctly by checking for import.meta.env.SSR.
  4. View that on all pages it goes from false to true, which is expected, except that on /bar/mdx it stays on false.
  5. Be confused 😁

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions