MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / updateFromMap

Function updateFromMap

code/redux/public/app.js:9425–9465  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, expirationTime)

Source from the content-addressed store, hash-verified

9423 }
9424
9425 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
9426 if (typeof newChild === 'string' || typeof newChild === 'number') {
9427 // Text nodes don't have keys, so we neither have to check the old nor
9428 // new node for the key. If both are text nodes, they match.
9429 var matchedFiber = existingChildren.get(newIdx) || null;
9430 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
9431 }
9432
9433 if (typeof newChild === 'object' && newChild !== null) {
9434 switch (newChild.$$typeof) {
9435 case REACT_ELEMENT_TYPE:
9436 {
9437 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9438 if (newChild.type === REACT_FRAGMENT_TYPE) {
9439 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
9440 }
9441 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
9442 }
9443 case REACT_PORTAL_TYPE:
9444 {
9445 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9446 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
9447 }
9448 }
9449
9450 if (isArray$1(newChild) || getIteratorFn(newChild)) {
9451 var _matchedFiber3 = existingChildren.get(newIdx) || null;
9452 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
9453 }
9454
9455 throwOnInvalidObjectType(returnFiber, newChild);
9456 }
9457
9458 {
9459 if (typeof newChild === 'function') {
9460 warnOnFunctionType();
9461 }
9462 }
9463
9464 return null;
9465 }
9466
9467 /**
9468 * Warns if there is a duplicate or missing key

Callers 2

reconcileChildrenArrayFunction · 0.70

Calls 7

updateTextNodeFunction · 0.70
updateFragmentFunction · 0.70
updateElementFunction · 0.70
updatePortalFunction · 0.70
getIteratorFnFunction · 0.70
throwOnInvalidObjectTypeFunction · 0.70
warnOnFunctionTypeFunction · 0.70

Tested by

no test coverage detected