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

Function reconcileSingleElement

code/communication/public/app.js:9588–9625  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, element, expirationTime)

Source from the content-addressed store, hash-verified

9586 }
9587
9588 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
9589 var key = element.key;
9590 var child = currentFirstChild;
9591 while (child !== null) {
9592 // TODO: If key === null and child.key === null, then this only applies to
9593 // the first item in the list.
9594 if (child.key === key) {
9595 if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {
9596 deleteRemainingChildren(returnFiber, child.sibling);
9597 var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
9598 existing.ref = coerceRef(returnFiber, child, element);
9599 existing['return'] = returnFiber;
9600 {
9601 existing._debugSource = element._source;
9602 existing._debugOwner = element._owner;
9603 }
9604 return existing;
9605 } else {
9606 deleteRemainingChildren(returnFiber, child);
9607 break;
9608 }
9609 } else {
9610 deleteChild(returnFiber, child);
9611 }
9612 child = child.sibling;
9613 }
9614
9615 if (element.type === REACT_FRAGMENT_TYPE) {
9616 var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
9617 created['return'] = returnFiber;
9618 return created;
9619 } else {
9620 var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
9621 _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
9622 _created4['return'] = returnFiber;
9623 return _created4;
9624 }
9625 }
9626
9627 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
9628 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