MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / updateFromMap

Function updateFromMap

code/composition/public/app.js:9312–9352  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, expirationTime)

Source from the content-addressed store, hash-verified

9310 }
9311
9312 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
9313 if (typeof newChild === 'string' || typeof newChild === 'number') {
9314 // Text nodes don't have keys, so we neither have to check the old nor
9315 // new node for the key. If both are text nodes, they match.
9316 var matchedFiber = existingChildren.get(newIdx) || null;
9317 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
9318 }
9319
9320 if (typeof newChild === 'object' && newChild !== null) {
9321 switch (newChild.$$typeof) {
9322 case REACT_ELEMENT_TYPE:
9323 {
9324 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9325 if (newChild.type === REACT_FRAGMENT_TYPE) {
9326 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
9327 }
9328 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
9329 }
9330 case REACT_PORTAL_TYPE:
9331 {
9332 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9333 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
9334 }
9335 }
9336
9337 if (isArray$1(newChild) || getIteratorFn(newChild)) {
9338 var _matchedFiber3 = existingChildren.get(newIdx) || null;
9339 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
9340 }
9341
9342 throwOnInvalidObjectType(returnFiber, newChild);
9343 }
9344
9345 {
9346 if (typeof newChild === 'function') {
9347 warnOnFunctionType();
9348 }
9349 }
9350
9351 return null;
9352 }
9353
9354 /**
9355 * 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