Skip to content

Commit a38b832

Browse files
committed
yak shaving
1 parent 9050394 commit a38b832

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

packages/next/client/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,17 @@ function renderReactElement(
534534

535535
const reactEl = fn(shouldHydrate ? markHydrateComplete : markRenderComplete)
536536
if (process.env.__NEXT_REACT_ROOT) {
537-
const createRootName =
538-
typeof (ReactDOM as any).unstable_createRoot === 'function'
539-
? 'unstable_createRoot'
540-
: 'createRoot'
541-
reactRoot =
542-
reactRoot ??
543-
(ReactDOM as any)[createRootName](domEl, { hydrate: shouldHydrate })
544-
shouldHydrate = false
537+
if (!reactRoot) {
538+
const createRootName =
539+
typeof (ReactDOM as any).unstable_createRoot === 'function'
540+
? 'unstable_createRoot'
541+
: 'createRoot'
542+
reactRoot = (ReactDOM as any)[createRootName](domEl, {
543+
hydrate: shouldHydrate,
544+
})
545+
}
545546
reactRoot.render(reactEl)
547+
shouldHydrate = false
546548
} else {
547549
// The check for `.hydrate` is there to support React alternatives like preact
548550
if (shouldHydrate) {

0 commit comments

Comments
 (0)