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

Function reconcileSingleElement

docs/external/js/react-dom.development.js:14298–14374  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, element, expirationTime)

Source from the content-addressed store, hash-verified

14296 }
14297
14298 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
14299 var key = element.key;
14300 var child = currentFirstChild;
14301
14302 while (child !== null) {
14303 // TODO: If key === null and child.key === null, then this only applies to
14304 // the first item in the list.
14305 if (child.key === key) {
14306 switch (child.tag) {
14307 case Fragment:
14308 {
14309 if (element.type === REACT_FRAGMENT_TYPE) {
14310 deleteRemainingChildren(returnFiber, child.sibling);
14311 var existing = useFiber(child, element.props.children);
14312 existing.return = returnFiber;
14313
14314 {
14315 existing._debugSource = element._source;
14316 existing._debugOwner = element._owner;
14317 }
14318
14319 return existing;
14320 }
14321
14322 break;
14323 }
14324
14325 case Block:
14326
14327 // We intentionally fallthrough here if enableBlocksAPI is not on.
14328 // eslint-disable-next-lined no-fallthrough
14329
14330 default:
14331 {
14332 if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
14333 isCompatibleFamilyForHotReloading(child, element) )) {
14334 deleteRemainingChildren(returnFiber, child.sibling);
14335
14336 var _existing3 = useFiber(child, element.props);
14337
14338 _existing3.ref = coerceRef(returnFiber, child, element);
14339 _existing3.return = returnFiber;
14340
14341 {
14342 _existing3._debugSource = element._source;
14343 _existing3._debugOwner = element._owner;
14344 }
14345
14346 return _existing3;
14347 }
14348
14349 break;
14350 }
14351 } // Didn't match.
14352
14353
14354 deleteRemainingChildren(returnFiber, child);
14355 break;

Callers 1

reconcileChildFibersFunction · 0.85

Calls 7

deleteRemainingChildrenFunction · 0.85
useFiberFunction · 0.85
coerceRefFunction · 0.85
deleteChildFunction · 0.85
createFiberFromFragmentFunction · 0.85
createFiberFromElementFunction · 0.85

Tested by

no test coverage detected