MCPcopy Create free account
hub / github.com/plotly/dash / reconcileChildrenIterator

Function reconcileChildrenIterator

dash/deps/react-dom@18.3.1.js:13721–13913  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, newChildrenIterable, lanes)

Source from the content-addressed store, hash-verified

13719 }
13720
13721 function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) {
13722 // This is the same implementation as reconcileChildrenArray(),
13723 // but using the iterator instead.
13724 var iteratorFn = getIteratorFn(newChildrenIterable);
13725
13726 if (typeof iteratorFn !== 'function') {
13727 throw new Error('An object is not an iterable. This error is likely caused by a bug in ' + 'React. Please file an issue.');
13728 }
13729
13730 {
13731 // We don't support rendering Generators because it's a mutation.
13732 // See https://github.com/facebook/react/issues/12995
13733 if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag
13734 newChildrenIterable[Symbol.toStringTag] === 'Generator') {
13735 if (!didWarnAboutGenerators) {
13736 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.');
13737 }
13738
13739 didWarnAboutGenerators = true;
13740 } // Warn about using Maps as children
13741
13742
13743 if (newChildrenIterable.entries === iteratorFn) {
13744 if (!didWarnAboutMaps) {
13745 error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
13746 }
13747
13748 didWarnAboutMaps = true;
13749 } // First, validate keys.
13750 // We'll get a different iterator later for the main pass.
13751
13752
13753 var _newChildren = iteratorFn.call(newChildrenIterable);
13754
13755 if (_newChildren) {
13756 var knownKeys = null;
13757
13758 var _step = _newChildren.next();
13759
13760 for (; !_step.done; _step = _newChildren.next()) {
13761 var child = _step.value;
13762 knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
13763 }
13764 }
13765 }
13766
13767 var newChildren = iteratorFn.call(newChildrenIterable);
13768
13769 if (newChildren == null) {
13770 throw new Error('An iterable object provided no iterator.');
13771 }
13772
13773 var resultingFirstChild = null;
13774 var previousNewFiber = null;
13775 var oldFiber = currentFirstChild;
13776 var lastPlacedIndex = 0;
13777 var newIdx = 0;
13778 var nextOldFiber = null;

Callers 1

reconcileChildFibersFunction · 0.70

Calls 13

getIteratorFnFunction · 0.70
errorFunction · 0.70
warnOnInvalidKeyFunction · 0.70
updateSlotFunction · 0.70
deleteChildFunction · 0.70
placeChildFunction · 0.70
deleteRemainingChildrenFunction · 0.70
getIsHydratingFunction · 0.70
pushTreeForkFunction · 0.70
createChildFunction · 0.70
mapRemainingChildrenFunction · 0.70
updateFromMapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…