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

Function updateHostComponent

lib/assets/react-source/development/react.js:20960–20999  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

20958 }
20959
20960 function updateHostComponent(current, workInProgress, renderExpirationTime) {
20961 pushHostContext(workInProgress);
20962
20963 if (current === null) {
20964 tryToClaimNextHydratableInstance(workInProgress);
20965 }
20966
20967 var type = workInProgress.type;
20968 var nextProps = workInProgress.pendingProps;
20969 var prevProps = current !== null ? current.memoizedProps : null;
20970 var nextChildren = nextProps.children;
20971 var isDirectTextChild = shouldSetTextContent(type, nextProps);
20972
20973 if (isDirectTextChild) {
20974 // We special case a direct text child of a host node. This is a common
20975 // case. We won't handle it as a reified child. We will instead handle
20976 // this in the host environment that also has access to this prop. That
20977 // avoids allocating another HostText fiber and traversing it.
20978 nextChildren = null;
20979 } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
20980 // If we're switching from a direct text child to a normal child, or to
20981 // empty, we need to schedule the text content to be reset.
20982 workInProgress.effectTag |= ContentReset;
20983 }
20984
20985 markRef(current, workInProgress); // Check the host config to see if the children are offscreen/hidden.
20986
20987 if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
20988 {
20989 markSpawnedWork(Never);
20990 } // Schedule this fiber to re-render at offscreen priority. Then bailout.
20991
20992
20993 workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
20994 return null;
20995 }
20996
20997 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
20998 return workInProgress.child;
20999 }
21000
21001 function updateHostText(current, workInProgress) {
21002 if (current === null) {

Callers 1

beginWorkFunction · 0.85

Calls 7

pushHostContextFunction · 0.85
shouldSetTextContentFunction · 0.85
markRefFunction · 0.85
markSpawnedWorkFunction · 0.85
reconcileChildrenFunction · 0.85

Tested by

no test coverage detected