Skip to content

🐛 BUG: React component hydration error when loaded with client:only #3010

@jhuleatt

Description

@jhuleatt

What version of astro are you using?

1.0.0-beta.2

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

@astrojs/react: 0.1.0

React components loaded with client:only show a hydration error:

Screen Shot 2022-04-06 at 3 06 20 PM

The component still works, it just makes React unhappy. client:only skips the component at build time, so there's nothing to hydrate. React components rendered withclient:only should probably use createRoot instead of hydrateRoot:

Though in looking at the code, there is a suppressHydrationWarning flag - is that related?:

{ ...props, suppressHydrationWarning: true },

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-2hpcon

Participation

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

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions