File tree Expand file tree Collapse file tree 2 files changed +42
-50
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +42
-50
lines changed Original file line number Diff line number Diff line change @@ -1231,9 +1231,7 @@ function ChildReconciler(shouldTrackSideEffects) {
12311231 }
12321232
12331233 // Handle object types
1234- const isObject = typeof newChild === 'object' && newChild !== null ;
1235-
1236- if ( isObject ) {
1234+ if ( typeof newChild === 'object' && newChild !== null ) {
12371235 switch ( newChild . $$typeof ) {
12381236 case REACT_ELEMENT_TYPE :
12391237 return placeSingleChild (
@@ -1266,6 +1264,26 @@ function ChildReconciler(shouldTrackSideEffects) {
12661264 ) ;
12671265 }
12681266 }
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 ) ;
12691287 }
12701288
12711289 if ( typeof newChild === 'string' || typeof newChild === 'number' ) {
@@ -1279,28 +1297,6 @@ function ChildReconciler(shouldTrackSideEffects) {
12791297 ) ;
12801298 }
12811299
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-
13041300 if ( __DEV__ ) {
13051301 if ( typeof newChild === 'function' ) {
13061302 warnOnFunctionType ( returnFiber ) ;
Original file line number Diff line number Diff line change @@ -1231,9 +1231,7 @@ function ChildReconciler(shouldTrackSideEffects) {
12311231 }
12321232
12331233 // Handle object types
1234- const isObject = typeof newChild === 'object' && newChild !== null ;
1235-
1236- if ( isObject ) {
1234+ if ( typeof newChild === 'object' && newChild !== null ) {
12371235 switch ( newChild . $$typeof ) {
12381236 case REACT_ELEMENT_TYPE :
12391237 return placeSingleChild (
@@ -1266,6 +1264,26 @@ function ChildReconciler(shouldTrackSideEffects) {
12661264 ) ;
12671265 }
12681266 }
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 ) ;
12691287 }
12701288
12711289 if ( typeof newChild === 'string' || typeof newChild === 'number' ) {
@@ -1279,28 +1297,6 @@ function ChildReconciler(shouldTrackSideEffects) {
12791297 ) ;
12801298 }
12811299
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-
13041300 if ( __DEV__ ) {
13051301 if ( typeof newChild === 'function' ) {
13061302 warnOnFunctionType ( returnFiber ) ;
You can’t perform that action at this time.
0 commit comments