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

Function updateFromMap

code/dependency-injection/public/app.js:9267–9307  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, expirationTime)

Source from the content-addressed store, hash-verified

9265 }
9266
9267 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
9268 if (typeof newChild === 'string' || typeof newChild === 'number') {
9269 // Text nodes don't have keys, so we neither have to check the old nor
9270 // new node for the key. If both are text nodes, they match.
9271 var matchedFiber = existingChildren.get(newIdx) || null;
9272 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
9273 }
9274
9275 if (typeof newChild === 'object' && newChild !== null) {
9276 switch (newChild.$$typeof) {
9277 case REACT_ELEMENT_TYPE:
9278 {
9279 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9280 if (newChild.type === REACT_FRAGMENT_TYPE) {
9281 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
9282 }
9283 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
9284 }
9285 case REACT_PORTAL_TYPE:
9286 {
9287 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9288 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
9289 }
9290 }
9291
9292 if (isArray$1(newChild) || getIteratorFn(newChild)) {
9293 var _matchedFiber3 = existingChildren.get(newIdx) || null;
9294 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
9295 }
9296
9297 throwOnInvalidObjectType(returnFiber, newChild);
9298 }
9299
9300 {
9301 if (typeof newChild === 'function') {
9302 warnOnFunctionType();
9303 }
9304 }
9305
9306 return null;
9307 }
9308
9309 /**
9310 * 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