Skip to content

Commit

Permalink
Fix: React - Use "createRoot" instead of "hydrateRoot" for `client:on…
Browse files Browse the repository at this point in the history
…ly` (withastro#3337)

* feat: pass "client" directive to clientEntrypoints

* refactor: remove hydration warning suppression react 17

* feat: remove hydration warning suppression react 18

* chore: changeset

* fix: change metadata to options bag
  • Loading branch information
bholmesdev authored May 12, 2022
1 parent d86c348 commit 5f47408
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/server/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ export async function generateHydrateScript(
);
}

let hydrationSource = ``;

hydrationSource += renderer.clientEntrypoint
const hydrationSource = renderer.clientEntrypoint
? `const [{ ${
componentExport.value
}: Component }, { default: hydrate }] = await Promise.all([import("${await result.resolve(
componentUrl
)}"), import("${await result.resolve(renderer.clientEntrypoint)}")]);
return (el, children) => hydrate(el)(Component, ${serializeProps(props)}, children);
return (el, children) => hydrate(el)(Component, ${serializeProps(
props
)}, children, ${JSON.stringify({ client: hydrate })});
`
: `await import("${await result.resolve(componentUrl)}");
return () => {};
Expand Down

0 comments on commit 5f47408

Please sign in to comment.