Skip to content

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Nov 4, 2025

Changes

Adds clientEntrypoint to the object returned by getContainerRenderer() in framework integrations. This makes the return value an AstroRenderer, so this also deprecates the ContainerRenderer type in favour of that. In several integrations there is already a getRenderer function that returns this, but this isn't standardised, and some need arguments. This PR tries to wrap or re-export these where appropriate.

It seems we were already specifying AstroRenderer as the type passed to loadRenderers, so this doesn't need changing.

The reason to do this is to support client hydration in getContainerRenderer(). The objects returned from these can be used with the loadRenderers helper in a Vite environment, instead of needing users to manually load the correct renderer entrypoints. Previously this didn't return the client entrypoint value, so it required users to manually call container.addClientRenderer() with the appropriate client renderer entrypoint to support hydration.

Testing

Our tests don't use Vitest so we can't test this directly. Instead, I added this to examples/container-with-vitest and tested that.

Docs

The docs don't currently state that client-side hydration is unsupported when using getContainerRenderer, so this doesn't need changing.

@github-actions github-actions bot added pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope) labels Nov 4, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: f7ce94a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: example Related to an example package (scope) pkg: react Related to React (scope) pkg: preact Related to Preact (scope) pkg: solid Related to Solid (scope) pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) labels Nov 4, 2025
Comment on lines +14 to +17
export function isSupportedReactVersion(
majorVersion: number,
): majorVersion is SupportedReactVersion {
return majorVersion in versionsConfig;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flipped the logic on this so it works better as a type predicate

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 4, 2025

CodSpeed Performance Report

Merging #14715 will not alter performance

Comparing container-renderer-client (f7ce94a) with main (a4d284d)

Summary

✅ 6 untouched

@ascorbic ascorbic merged commit 3d55c5d into main Nov 5, 2025
27 checks passed
@ascorbic ascorbic deleted the container-renderer-client branch November 5, 2025 07:35
@astrobot-houston astrobot-houston mentioned this pull request Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) pkg: integration Related to any renderer integration (scope) pkg: preact Related to Preact (scope) pkg: react Related to React (scope) pkg: solid Related to Solid (scope) pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants