@samitouri / QOS-React / commits / 16956ed640

disableNewFiberFeatures bugfix: host component children arrays

Andrew Clark committed Jan 14, 2017 at 18:22 UTC 16956ed64044665a44ed7f9d2e7c3d8933188926
3 files changed +28
scripts/fiber/tests-passing.txt
+1
@@ -554,6 +554,7 @@ src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
554 * should not crash encountering low-priority tree
555 * throws if non-element passed to top-level render
556 * throws if something other than false, null, or an element is returned from render
557 +* still accepts arrays as host children
558
559 src/renderers/dom/shared/__tests__/CSSProperty-test.js
560 * should generate browser prefixes for its `isUnitlessNumber`
src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
+8
@@ -1119,6 +1119,14 @@ describe('ReactDOMFiber', () => {
1119 expect(() => ReactDOM.render(<Render>{999}</Render>, container)).toThrow(/You may have returned undefined/);
1120 expect(() => ReactDOM.render(<Render>[<div />]</Render>, container)).toThrow(/You may have returned undefined/);
1121 });
1122 +
1123 + it('still accepts arrays as host children', () => {
1124 + function Render(props) {
1125 + return <div>{props.children}</div>;
1126 + }
1127 + ReactDOM.render(<Render>{['foo', 'bar']}</Render>, container);
1128 + expect(container.textContent).toEqual('foobar');
1129 + });
1130 });
1131 }
1132 });
src/renderers/shared/fiber/ReactChildFiber.js
+19
@@ -1163,6 +1163,25 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
1163 }
1164 }
1165 }
1166 +
1167 + if (isArray(newChild)) {
1168 + return reconcileChildrenArray(
1169 + returnFiber,
1170 + currentFirstChild,
1171 + newChild,
1172 + priority
1173 + );
1174 + }
1175 +
1176 + if (getIteratorFn(newChild)) {
1177 + return reconcileChildrenIterator(
1178 + returnFiber,
1179 + currentFirstChild,
1180 + newChild,
1181 + priority
1182 + );
1183 + }
1184 +
1185 return deleteRemainingChildren(returnFiber, currentFirstChild);
1186 }
1187