File tree 2 files changed +42
-50
lines changed
packages/react-reconciler/src 2 files changed +42
-50
lines changed Original file line number Diff line number Diff line change @@ -1231,9 +1231,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1231
1231
}
1232
1232
1233
1233
// Handle object types
1234
- const isObject = typeof newChild === 'object' && newChild !== null ;
1235
-
1236
- if ( isObject ) {
1234
+ if ( typeof newChild === 'object' && newChild !== null ) {
1237
1235
switch ( newChild . $$typeof ) {
1238
1236
case REACT_ELEMENT_TYPE :
1239
1237
return placeSingleChild (
@@ -1266,6 +1264,26 @@ function ChildReconciler(shouldTrackSideEffects) {
1266
1264
) ;
1267
1265
}
1268
1266
}
1267
+
1268
+ if ( isArray ( newChild ) ) {
1269
+ return reconcileChildrenArray (
1270
+ returnFiber ,
1271
+ currentFirstChild ,
1272
+ newChild ,
1273
+ lanes ,
1274
+ ) ;
1275
+ }
1276
+
1277
+ if ( getIteratorFn ( newChild ) ) {
1278
+ return reconcileChildrenIterator (
1279
+ returnFiber ,
1280
+ currentFirstChild ,
1281
+ newChild ,
1282
+ lanes ,
1283
+ ) ;
1284
+ }
1285
+
1286
+ throwOnInvalidObjectType ( returnFiber , newChild ) ;
1269
1287
}
1270
1288
1271
1289
if ( typeof newChild === 'string' || typeof newChild === 'number' ) {
@@ -1279,28 +1297,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1279
1297
) ;
1280
1298
}
1281
1299
1282
- if ( isArray ( newChild ) ) {
1283
- return reconcileChildrenArray (
1284
- returnFiber ,
1285
- currentFirstChild ,
1286
- newChild ,
1287
- lanes ,
1288
- ) ;
1289
- }
1290
-
1291
- if ( getIteratorFn ( newChild ) ) {
1292
- return reconcileChildrenIterator (
1293
- returnFiber ,
1294
- currentFirstChild ,
1295
- newChild ,
1296
- lanes ,
1297
- ) ;
1298
- }
1299
-
1300
- if ( isObject ) {
1301
- throwOnInvalidObjectType ( returnFiber , newChild ) ;
1302
- }
1303
-
1304
1300
if ( __DEV__ ) {
1305
1301
if ( typeof newChild === 'function' ) {
1306
1302
warnOnFunctionType ( returnFiber ) ;
Original file line number Diff line number Diff line change @@ -1231,9 +1231,7 @@ function ChildReconciler(shouldTrackSideEffects) {
1231
1231
}
1232
1232
1233
1233
// Handle object types
1234
- const isObject = typeof newChild === 'object' && newChild !== null ;
1235
-
1236
- if ( isObject ) {
1234
+ if ( typeof newChild === 'object' && newChild !== null ) {
1237
1235
switch ( newChild . $$typeof ) {
1238
1236
case REACT_ELEMENT_TYPE :
1239
1237
return placeSingleChild (
@@ -1266,6 +1264,26 @@ function ChildReconciler(shouldTrackSideEffects) {
1266
1264
) ;
1267
1265
}
1268
1266
}
1267
+
1268
+ if ( isArray ( newChild ) ) {
1269
+ return reconcileChildrenArray (
1270
+ returnFiber ,
1271
+ currentFirstChild ,
1272
+ newChild ,
1273
+ lanes ,
1274
+ ) ;
1275
+ }
1276
+
1277
+ if ( getIteratorFn ( newChild ) ) {
1278
+ return reconcileChildrenIterator (
1279
+ returnFiber ,
1280
+ currentFirstChild ,
1281
+ newChild ,
1282
+ lanes ,
1283
+ ) ;
1284
+ }
1285
+
1286
+ throwOnInvalidObjectType ( returnFiber , newChild ) ;
1269
1287
}
1270
1288
1271
1289
if ( typeof newChild === 'string' || typeof newChild === 'number' ) {
@@ -1279,28 +1297,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1279
1297
) ;
1280
1298
}
1281
1299
1282
- if ( isArray ( newChild ) ) {
1283
- return reconcileChildrenArray (
1284
- returnFiber ,
1285
- currentFirstChild ,
1286
- newChild ,
1287
- lanes ,
1288
- ) ;
1289
- }
1290
-
1291
- if ( getIteratorFn ( newChild ) ) {
1292
- return reconcileChildrenIterator (
1293
- returnFiber ,
1294
- currentFirstChild ,
1295
- newChild ,
1296
- lanes ,
1297
- ) ;
1298
- }
1299
-
1300
- if ( isObject ) {
1301
- throwOnInvalidObjectType ( returnFiber , newChild ) ;
1302
- }
1303
-
1304
1300
if ( __DEV__ ) {
1305
1301
if ( typeof newChild === 'function' ) {
1306
1302
warnOnFunctionType ( returnFiber ) ;
You can’t perform that action at this time.
0 commit comments