MCPcopy Create free account
hub / github.com/reactjs/react-rails / reconcileSingleElement

Function reconcileSingleElement

lib/assets/react-source/development/react.js:17858–17934  ·  view source on GitHub ↗
(returnFiber, currentFirstChild, element, expirationTime)

Source from the content-addressed store, hash-verified

17856 }
17857
17858 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
17859 var key = element.key;
17860 var child = currentFirstChild;
17861
17862 while (child !== null) {
17863 // TODO: If key === null and child.key === null, then this only applies to
17864 // the first item in the list.
17865 if (child.key === key) {
17866 switch (child.tag) {
17867 case Fragment:
17868 {
17869 if (element.type === REACT_FRAGMENT_TYPE) {
17870 deleteRemainingChildren(returnFiber, child.sibling);
17871 var existing = useFiber(child, element.props.children);
17872 existing.return = returnFiber;
17873
17874 {
17875 existing._debugSource = element._source;
17876 existing._debugOwner = element._owner;
17877 }
17878
17879 return existing;
17880 }
17881
17882 break;
17883 }
17884
17885 case Block:
17886
17887 // We intentionally fallthrough here if enableBlocksAPI is not on.
17888 // eslint-disable-next-lined no-fallthrough
17889
17890 default:
17891 {
17892 if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
17893 isCompatibleFamilyForHotReloading(child, element) )) {
17894 deleteRemainingChildren(returnFiber, child.sibling);
17895
17896 var _existing3 = useFiber(child, element.props);
17897
17898 _existing3.ref = coerceRef(returnFiber, child, element);
17899 _existing3.return = returnFiber;
17900
17901 {
17902 _existing3._debugSource = element._source;
17903 _existing3._debugOwner = element._owner;
17904 }
17905
17906 return _existing3;
17907 }
17908
17909 break;
17910 }
17911 } // Didn't match.
17912
17913
17914 deleteRemainingChildren(returnFiber, child);
17915 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