MCPcopy Create free account
hub / github.com/microsoft/SandDance / updateFromMap

Function updateFromMap

docs/external/js/react-dom.development.js:13858–13903  ·  view source on GitHub ↗
(existingChildren, returnFiber, newIdx, newChild, expirationTime)

Source from the content-addressed store, hash-verified

13856 }
13857
13858 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
13859 if (typeof newChild === 'string' || typeof newChild === 'number') {
13860 // Text nodes don't have keys, so we neither have to check the old nor
13861 // new node for the key. If both are text nodes, they match.
13862 var matchedFiber = existingChildren.get(newIdx) || null;
13863 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
13864 }
13865
13866 if (typeof newChild === 'object' && newChild !== null) {
13867 switch (newChild.$$typeof) {
13868 case REACT_ELEMENT_TYPE:
13869 {
13870 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
13871
13872 if (newChild.type === REACT_FRAGMENT_TYPE) {
13873 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
13874 }
13875
13876 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
13877 }
13878
13879 case REACT_PORTAL_TYPE:
13880 {
13881 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
13882
13883 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
13884 }
13885 }
13886
13887 if (isArray$1(newChild) || getIteratorFn(newChild)) {
13888 var _matchedFiber3 = existingChildren.get(newIdx) || null;
13889
13890 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
13891 }
13892
13893 throwOnInvalidObjectType(returnFiber, newChild);
13894 }
13895
13896 {
13897 if (typeof newChild === 'function') {
13898 warnOnFunctionType();
13899 }
13900 }
13901
13902 return null;
13903 }
13904 /**
13905 * Warns if there is a duplicate or missing key
13906 */

Callers 2

reconcileChildrenArrayFunction · 0.85

Calls 8

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

Tested by

no test coverage detected