MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / updateHostRoot

Function updateHostRoot

bundle.js:7385–7401  ·  view source on GitHub ↗
(current,workInProgress,priorityLevel)

Source from the content-addressed store, hash-verified

7383memoizeState(workInProgress,instance.state);memoizeProps(workInProgress,instance.props);// The context might have changed so we need to recalculate it.
7384if(hasContext){invalidateContextProvider$1(workInProgress,true);}return workInProgress.child;}function pushHostRootContext(workInProgress){var root=workInProgress.stateNode;if(root.pendingContext){pushTopLevelContextObject$1(workInProgress,root.pendingContext,root.pendingContext!==root.context);}else if(root.context){// Should always be set
7385pushTopLevelContextObject$1(workInProgress,root.context,false);}pushHostContainer(workInProgress,root.containerInfo);}function updateHostRoot(current,workInProgress,priorityLevel){pushHostRootContext(workInProgress);var updateQueue=workInProgress.updateQueue;if(updateQueue!==null){var prevState=workInProgress.memoizedState;var state=beginUpdateQueue$1(current,workInProgress,updateQueue,null,prevState,null,priorityLevel);if(prevState===state){// If the state is the same as before, that's a bailout because we had
7386// no work matching this priority.
7387resetHydrationState();return bailoutOnAlreadyFinishedWork(current,workInProgress);}var element=state.element;if((current===null||current.child===null)&&enterHydrationState(workInProgress)){// If we don't have any current children this might be the first pass.
7388// We always try to hydrate. If this isn't a hydration pass there won't
7389// be any children to hydrate which is effectively the same thing as
7390// not hydrating.
7391// This is a bit of a hack. We track the host root as a placement to
7392// know that we're currently in a mounting state. That way isMounted
7393// works as expected. We must reset this before committing.
7394// TODO: Delete this when we delete isMounted and findDOMNode.
7395workInProgress.effectTag|=Placement$2;// Ensure that children mount into this root without tracking
7396// side-effects. This ensures that we don't store Placement effects on
7397// nodes that will be hydrated.
7398workInProgress.child=mountChildFibersInPlace(workInProgress,workInProgress.child,element,priorityLevel);}else{// Otherwise reset hydration state in case we aborted and resumed another
7399// root.
7400resetHydrationState();reconcileChildren(current,workInProgress,element);}memoizeState(workInProgress,state);return workInProgress.child;}resetHydrationState();// If there is no update queue, that's a bailout because the root has no props.
7401return bailoutOnAlreadyFinishedWork(current,workInProgress);}function updateHostComponent(current,workInProgress,renderPriority){pushHostContext(workInProgress);if(current===null){tryToClaimNextHydratableInstance(workInProgress);}var type=workInProgress.type;var memoizedProps=workInProgress.memoizedProps;var nextProps=workInProgress.pendingProps;if(nextProps===null){nextProps=memoizedProps;!(nextProps!==null)?invariant(false,'We should always have pending or current props. This error is likely caused by a bug in React. Please file an issue.'):void 0;}var prevProps=current!==null?current.memoizedProps:null;if(hasContextChanged$1()){// Normally we can bail out on props equality but if context has changed
7402// we don't do the bailout and we have to reuse existing props instead.
7403}else if(nextProps===null||memoizedProps===nextProps){return bailoutOnAlreadyFinishedWork(current,workInProgress);}var nextChildren=nextProps.children;var isDirectTextChild=shouldSetTextContent(type,nextProps);if(isDirectTextChild){// We special case a direct text child of a host node. This is a common
7404// case. We won't handle it as a reified child. We will instead handle

Callers 1

beginWorkFunction · 0.85

Calls 6

pushHostRootContextFunction · 0.85
resetHydrationStateFunction · 0.85
enterHydrationStateFunction · 0.85
reconcileChildrenFunction · 0.85
memoizeStateFunction · 0.85

Tested by

no test coverage detected