@@ -77,8 +77,8 @@ const mountedContainers = new Set()
77
77
*/
78
78
const mountedRootEntries = [ ]
79
79
80
- function strictModeIfNeeded ( innerElement ) {
81
- return getConfig ( ) . reactStrictMode
80
+ function strictModeIfNeeded ( innerElement , reactStrictMode ) {
81
+ return reactStrictMode ?? getConfig ( ) . reactStrictMode
82
82
? React . createElement ( React . StrictMode , null , innerElement )
83
83
: innerElement
84
84
}
@@ -91,14 +91,14 @@ function wrapUiIfNeeded(innerElement, wrapperComponent) {
91
91
92
92
function createConcurrentRoot (
93
93
container ,
94
- { hydrate, onCaughtError, onRecoverableError, ui, wrapper : WrapperComponent } ,
94
+ { hydrate, onCaughtError, onRecoverableError, ui, wrapper : WrapperComponent , reactStrictMode } ,
95
95
) {
96
96
let root
97
97
if ( hydrate ) {
98
98
act ( ( ) => {
99
99
root = ReactDOMClient . hydrateRoot (
100
100
container ,
101
- strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) ) ,
101
+ strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) , reactStrictMode ) ,
102
102
{ onCaughtError, onRecoverableError} ,
103
103
)
104
104
} )
@@ -144,17 +144,17 @@ function createLegacyRoot(container) {
144
144
145
145
function renderRoot (
146
146
ui ,
147
- { baseElement, container, hydrate, queries, root, wrapper : WrapperComponent } ,
147
+ { baseElement, container, hydrate, queries, root, wrapper : WrapperComponent , reactStrictMode } ,
148
148
) {
149
149
act ( ( ) => {
150
150
if ( hydrate ) {
151
151
root . hydrate (
152
- strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) ) ,
152
+ strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) , reactStrictMode ) ,
153
153
container ,
154
154
)
155
155
} else {
156
156
root . render (
157
- strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) ) ,
157
+ strictModeIfNeeded ( wrapUiIfNeeded ( ui , WrapperComponent ) , reactStrictMode ) ,
158
158
container ,
159
159
)
160
160
}
@@ -180,6 +180,7 @@ function renderRoot(
180
180
baseElement,
181
181
root,
182
182
wrapper : WrapperComponent ,
183
+ reactStrictMode,
183
184
} )
184
185
// Intentionally do not return anything to avoid unnecessarily complicating the API.
185
186
// folks can use all the same utilities we return in the first place that are bound to the container
@@ -212,6 +213,7 @@ function render(
212
213
queries,
213
214
hydrate = false ,
214
215
wrapper,
216
+ reactStrictMode,
215
217
} = { } ,
216
218
) {
217
219
if ( onUncaughtError !== undefined ) {
@@ -248,6 +250,7 @@ function render(
248
250
onRecoverableError,
249
251
ui,
250
252
wrapper,
253
+ reactStrictMode,
251
254
} )
252
255
253
256
mountedRootEntries . push ( { container, root} )
@@ -273,6 +276,7 @@ function render(
273
276
hydrate,
274
277
wrapper,
275
278
root,
279
+ reactStrictMode,
276
280
} )
277
281
}
278
282
0 commit comments