File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -534,15 +534,17 @@ function renderReactElement(
534
534
535
535
const reactEl = fn ( shouldHydrate ? markHydrateComplete : markRenderComplete )
536
536
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
+ }
545
546
reactRoot . render ( reactEl )
547
+ shouldHydrate = false
546
548
} else {
547
549
// The check for `.hydrate` is there to support React alternatives like preact
548
550
if ( shouldHydrate ) {
You can’t perform that action at this time.
0 commit comments