(returnFiber, currentFirstChild, newChildrenIterable, expirationTime)
| 14094 | } |
| 14095 | |
| 14096 | function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) { |
| 14097 | // This is the same implementation as reconcileChildrenArray(), |
| 14098 | // but using the iterator instead. |
| 14099 | var iteratorFn = getIteratorFn(newChildrenIterable); |
| 14100 | |
| 14101 | if (!(typeof iteratorFn === 'function')) { |
| 14102 | { |
| 14103 | throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." ); |
| 14104 | } |
| 14105 | } |
| 14106 | |
| 14107 | { |
| 14108 | // We don't support rendering Generators because it's a mutation. |
| 14109 | // See https://github.com/facebook/react/issues/12995 |
| 14110 | if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag |
| 14111 | newChildrenIterable[Symbol.toStringTag] === 'Generator') { |
| 14112 | if (!didWarnAboutGenerators) { |
| 14113 | error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); |
| 14114 | } |
| 14115 | |
| 14116 | didWarnAboutGenerators = true; |
| 14117 | } // Warn about using Maps as children |
| 14118 | |
| 14119 | |
| 14120 | if (newChildrenIterable.entries === iteratorFn) { |
| 14121 | if (!didWarnAboutMaps) { |
| 14122 | error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.'); |
| 14123 | } |
| 14124 | |
| 14125 | didWarnAboutMaps = true; |
| 14126 | } // First, validate keys. |
| 14127 | // We'll get a different iterator later for the main pass. |
| 14128 | |
| 14129 | |
| 14130 | var _newChildren = iteratorFn.call(newChildrenIterable); |
| 14131 | |
| 14132 | if (_newChildren) { |
| 14133 | var knownKeys = null; |
| 14134 | |
| 14135 | var _step = _newChildren.next(); |
| 14136 | |
| 14137 | for (; !_step.done; _step = _newChildren.next()) { |
| 14138 | var child = _step.value; |
| 14139 | knownKeys = warnOnInvalidKey(child, knownKeys); |
| 14140 | } |
| 14141 | } |
| 14142 | } |
| 14143 | |
| 14144 | var newChildren = iteratorFn.call(newChildrenIterable); |
| 14145 | |
| 14146 | if (!(newChildren != null)) { |
| 14147 | { |
| 14148 | throw Error( "An iterable object provided no iterator." ); |
| 14149 | } |
| 14150 | } |
| 14151 | |
| 14152 | var resultingFirstChild = null; |
| 14153 | var previousNewFiber = null; |
no test coverage detected