MCPcopy Create free account
hub / github.com/plotly/dash / reconcileSingleElement

Function reconcileSingleElement

dash/deps/react-dom@18.3.1.js:13935–14002  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, element, lanes)

Source from the content-addressed store, hash-verified

13933 }
13934
13935 function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) {
13936 var key = element.key;
13937 var child = currentFirstChild;
13938
13939 while (child !== null) {
13940 // TODO: If key === null and child.key === null, then this only applies to
13941 // the first item in the list.
13942 if (child.key === key) {
13943 var elementType = element.type;
13944
13945 if (elementType === REACT_FRAGMENT_TYPE) {
13946 if (child.tag === Fragment) {
13947 deleteRemainingChildren(returnFiber, child.sibling);
13948 var existing = useFiber(child, element.props.children);
13949 existing.return = returnFiber;
13950
13951 {
13952 existing._debugSource = element._source;
13953 existing._debugOwner = element._owner;
13954 }
13955
13956 return existing;
13957 }
13958 } else {
13959 if (child.elementType === elementType || ( // Keep this check inline so it only runs on the false path:
13960 isCompatibleFamilyForHotReloading(child, element) ) || // Lazy types should reconcile their resolved type.
13961 // We need to do this after the Hot Reloading check above,
13962 // because hot reloading has different semantics than prod because
13963 // it doesn't resuspend. So we can't let the call below suspend.
13964 typeof elementType === 'object' && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) {
13965 deleteRemainingChildren(returnFiber, child.sibling);
13966
13967 var _existing = useFiber(child, element.props);
13968
13969 _existing.ref = coerceRef(returnFiber, child, element);
13970 _existing.return = returnFiber;
13971
13972 {
13973 _existing._debugSource = element._source;
13974 _existing._debugOwner = element._owner;
13975 }
13976
13977 return _existing;
13978 }
13979 } // Didn't match.
13980
13981
13982 deleteRemainingChildren(returnFiber, child);
13983 break;
13984 } else {
13985 deleteChild(returnFiber, child);
13986 }
13987
13988 child = child.sibling;
13989 }
13990
13991 if (element.type === REACT_FRAGMENT_TYPE) {
13992 var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key);

Callers 1

reconcileChildFibersFunction · 0.70

Calls 8

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…