Skip to content

Commit

Permalink
fix: react 17 ssr context error (#6023)
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Jul 31, 2024
1 parent 223d63b commit db43d8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/tasty-ads-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/runtime': patch
---

fix: react 17 ssr context error

fix: 修复 react 17 ssr 找不到 runtimeReactContext 报错
5 changes: 4 additions & 1 deletion packages/runtime/plugin-runtime/src/core/browser/hydrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export function hydrateRoot(
});
} else {
loadableReady(() => {
ModernHydrate(App, callback).then(root => {
ModernHydrate(
React.cloneElement(App, { _internal_context: hydrateContext }),
callback,
).then(root => {
resolve(root);
});
});
Expand Down

0 comments on commit db43d8e

Please sign in to comment.