Skip to content

Commit 34f2c65

Browse files
committed
[Beta] Hydrate with startTransition
1 parent fbde52c commit 34f2c65

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/node_modules/next/dist/client/index.js b/node_modules/next/dist/client/index.js
2+
index 8541301..f4c8dd7 100644
3+
--- a/node_modules/next/dist/client/index.js
4+
+++ b/node_modules/next/dist/client/index.js
5+
@@ -480,7 +480,10 @@ function renderReactElement(domEl, fn) {
6+
if (process.env.__NEXT_REACT_ROOT) {
7+
if (!reactRoot) {
8+
// Unlike with createRoot, you don't need a separate root.render() call here
9+
- reactRoot = ReactDOM.hydrateRoot(domEl, reactEl);
10+
+ const startTransition = _react.default.startTransition;
11+
+ startTransition(()=>{
12+
+ reactRoot = ReactDOM.hydrateRoot(domEl, reactEl);
13+
+ });
14+
// TODO: Remove shouldHydrate variable when React 18 is stable as it can depend on `reactRoot` existing
15+
shouldHydrate = false;
16+
} else {

0 commit comments

Comments
 (0)