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

Function updateFromMap

dash/deps/react-dom@18.3.1.js:13460–13506  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, lanes)

Source from the content-addressed store, hash-verified

13458 }
13459
13460 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) {
13461 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') {
13462 // Text nodes don't have keys, so we neither have to check the old nor
13463 // new node for the key. If both are text nodes, they match.
13464 var matchedFiber = existingChildren.get(newIdx) || null;
13465 return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes);
13466 }
13467
13468 if (typeof newChild === 'object' && newChild !== null) {
13469 switch (newChild.$$typeof) {
13470 case REACT_ELEMENT_TYPE:
13471 {
13472 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
13473
13474 return updateElement(returnFiber, _matchedFiber, newChild, lanes);
13475 }
13476
13477 case REACT_PORTAL_TYPE:
13478 {
13479 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
13480
13481 return updatePortal(returnFiber, _matchedFiber2, newChild, lanes);
13482 }
13483
13484 case REACT_LAZY_TYPE:
13485 var payload = newChild._payload;
13486 var init = newChild._init;
13487 return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes);
13488 }
13489
13490 if (isArray(newChild) || getIteratorFn(newChild)) {
13491 var _matchedFiber3 = existingChildren.get(newIdx) || null;
13492
13493 return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null);
13494 }
13495
13496 throwOnInvalidObjectType(returnFiber, newChild);
13497 }
13498
13499 {
13500 if (typeof newChild === 'function') {
13501 warnOnFunctionType(returnFiber);
13502 }
13503 }
13504
13505 return null;
13506 }
13507 /**
13508 * Warns if there is a duplicate or missing key
13509 */

Callers 2

reconcileChildrenArrayFunction · 0.70

Calls 9

updateTextNodeFunction · 0.70
updateElementFunction · 0.70
updatePortalFunction · 0.70
isArrayFunction · 0.70
getIteratorFnFunction · 0.70
updateFragmentFunction · 0.70
throwOnInvalidObjectTypeFunction · 0.70
warnOnFunctionTypeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…