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

feat(container): client hydration #11486

Merged
merged 6 commits into from
Jul 18, 2024
Merged

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jul 18, 2024

Changes

This PR fixes a bug inside the container API, where an error was thrown when rendering a client component using client:* directives.

Closes #11407

This issue was brought up on discord: https://discord.com/channels/830184174198718474/1255408685275021342

To fix the bug, I created a new API called addClientRenderer. This new API is very similar to addServerRenderer, but it has two restrictions:

  • It must be used after addServerRenderer. If there's no server renderer, an error is thrown.
  • It doesn't rely on any importing, because this is done on the client, so the user must provide the entrypoint instead

Testing

Added a new test case

Docs

N/A

Copy link

changeset-bot bot commented Jul 18, 2024

🦋 Changeset detected

Latest commit: 33a8cba

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: react Related to React (scope) pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jul 18, 2024
@ematipico ematipico force-pushed the fix/client-directives-container branch from cb81286 to 33a8cba Compare July 18, 2024 09:58
@github-actions github-actions bot removed the pr: docs A PR that includes documentation for review label Jul 18, 2024
@ematipico ematipico changed the title fix: prevent client hydration when rendering via Container API feat(container): client hydration when rendering via Container API Jul 18, 2024
@ematipico ematipico changed the title feat(container): client hydration when rendering via Container API feat(container): client hydration Jul 18, 2024
@ematipico ematipico merged commit 9c0c849 into main Jul 18, 2024
13 checks passed
@ematipico ematipico deleted the fix/client-directives-container branch July 18, 2024 15:28
@astrobot-houston astrobot-houston mentioned this pull request Jul 18, 2024
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: integration Related to any renderer integration (scope) pkg: react Related to React (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering an Astro container that contains a React component with a client:load directive errors
2 participants