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

Function updateFromMap

code/styling/public/app.js:9174–9214  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, expirationTime)

Source from the content-addressed store, hash-verified

9172 }
9173
9174 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
9175 if (typeof newChild === 'string' || typeof newChild === 'number') {
9176 // Text nodes don't have keys, so we neither have to check the old nor
9177 // new node for the key. If both are text nodes, they match.
9178 var matchedFiber = existingChildren.get(newIdx) || null;
9179 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
9180 }
9181
9182 if (typeof newChild === 'object' && newChild !== null) {
9183 switch (newChild.$$typeof) {
9184 case REACT_ELEMENT_TYPE:
9185 {
9186 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9187 if (newChild.type === REACT_FRAGMENT_TYPE) {
9188 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
9189 }
9190 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
9191 }
9192 case REACT_PORTAL_TYPE:
9193 {
9194 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
9195 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
9196 }
9197 }
9198
9199 if (isArray$1(newChild) || getIteratorFn(newChild)) {
9200 var _matchedFiber3 = existingChildren.get(newIdx) || null;
9201 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
9202 }
9203
9204 throwOnInvalidObjectType(returnFiber, newChild);
9205 }
9206
9207 {
9208 if (typeof newChild === 'function') {
9209 warnOnFunctionType();
9210 }
9211 }
9212
9213 return null;
9214 }
9215
9216 /**
9217 * 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