MCPcopy Index your code
hub / github.com/plotly/dash / updateFromMap

Function updateFromMap

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

Source from the content-addressed store, hash-verified

15222 }
15223
15224 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) {
15225 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') {
15226 // Text nodes don't have keys, so we neither have to check the old nor
15227 // new node for the key. If both are text nodes, they match.
15228 var matchedFiber = existingChildren.get(newIdx) || null;
15229 return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes);
15230 }
15231
15232 if (typeof newChild === 'object' && newChild !== null) {
15233 switch (newChild.$$typeof) {
15234 case REACT_ELEMENT_TYPE:
15235 {
15236 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
15237
15238 return updateElement(returnFiber, _matchedFiber, newChild, lanes);
15239 }
15240
15241 case REACT_PORTAL_TYPE:
15242 {
15243 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
15244
15245 return updatePortal(returnFiber, _matchedFiber2, newChild, lanes);
15246 }
15247
15248 case REACT_LAZY_TYPE:
15249 var payload = newChild._payload;
15250 var init = newChild._init;
15251 return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes);
15252 }
15253
15254 if (isArray(newChild) || getIteratorFn(newChild)) {
15255 var _matchedFiber3 = existingChildren.get(newIdx) || null;
15256
15257 return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null);
15258 }
15259
15260 throwOnInvalidObjectType(returnFiber, newChild);
15261 }
15262
15263 {
15264 if (typeof newChild === 'function') {
15265 warnOnFunctionType(returnFiber);
15266 }
15267 }
15268
15269 return null;
15270 }
15271 /**
15272 * Warns if there is a duplicate or missing key
15273 */

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…