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

Function reconcileSingleElement

code/new-context-api/public/app.js:8914–8951  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, element, expirationTime)

Source from the content-addressed store, hash-verified

8912 }
8913
8914 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
8915 var key = element.key;
8916 var child = currentFirstChild;
8917 while (child !== null) {
8918 // TODO: If key === null and child.key === null, then this only applies to
8919 // the first item in the list.
8920 if (child.key === key) {
8921 if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {
8922 deleteRemainingChildren(returnFiber, child.sibling);
8923 var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
8924 existing.ref = coerceRef(returnFiber, child, element);
8925 existing['return'] = returnFiber;
8926 {
8927 existing._debugSource = element._source;
8928 existing._debugOwner = element._owner;
8929 }
8930 return existing;
8931 } else {
8932 deleteRemainingChildren(returnFiber, child);
8933 break;
8934 }
8935 } else {
8936 deleteChild(returnFiber, child);
8937 }
8938 child = child.sibling;
8939 }
8940
8941 if (element.type === REACT_FRAGMENT_TYPE) {
8942 var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
8943 created['return'] = returnFiber;
8944 return created;
8945 } else {
8946 var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
8947 _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
8948 _created4['return'] = returnFiber;
8949 return _created4;
8950 }
8951 }
8952
8953 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
8954 var key = portal.key;

Callers 1

reconcileChildFibersFunction · 0.70

Calls 6

deleteRemainingChildrenFunction · 0.70
useFiberFunction · 0.70
coerceRefFunction · 0.70
deleteChildFunction · 0.70
createFiberFromFragmentFunction · 0.70
createFiberFromElementFunction · 0.70

Tested by

no test coverage detected