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

Function commitPlacement

bundle.js:7560–7568  ·  view source on GitHub ↗
(finishedWork)

Source from the content-addressed store, hash-verified

7558if(node.child===null||node.tag===HostPortal$7){continue siblings;}else{node.child['return']=node;node=node.child;}}// Check if this host node is stable or about to be placed.
7559if(!(node.effectTag&Placement$5)){// Found it!
7560return node.stateNode;}}}function commitPlacement(finishedWork){// Recursively insert all host nodes into the parent.
7561var parentFiber=getHostParentFiber(finishedWork);var parent=void 0;var isContainer=void 0;switch(parentFiber.tag){case HostComponent$9:parent=parentFiber.stateNode;isContainer=false;break;case HostRoot$9:parent=parentFiber.stateNode.containerInfo;isContainer=true;break;case HostPortal$7:parent=parentFiber.stateNode.containerInfo;isContainer=true;break;default:invariant(false,'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');}if(parentFiber.effectTag&ContentReset$2){// Reset the text content of the parent before doing any insertions
7562resetTextContent(parent);// Clear ContentReset from the effect tag
7563parentFiber.effectTag&=~ContentReset$2;}var before=getHostSibling(finishedWork);// We only have the top Fiber that was inserted but we need recurse down its
7564// children to find all the terminal nodes.
7565var node=finishedWork;while(true){if(node.tag===HostComponent$9||node.tag===HostText$7){if(before){if(isContainer){insertInContainerBefore(parent,node.stateNode,before);}else{insertBefore(parent,node.stateNode,before);}}else{if(isContainer){appendChildToContainer(parent,node.stateNode);}else{appendChild(parent,node.stateNode);}}}else if(node.tag===HostPortal$7){// If the insertion itself is a portal, then we don't want to traverse
7566// down its children. Instead, we'll get insertions from each child in
7567// the portal directly.
7568}else if(node.child!==null){node.child['return']=node;node=node.child;continue;}if(node===finishedWork){return;}while(node.sibling===null){if(node['return']===null||node['return']===finishedWork){return;}node=node['return'];}node.sibling['return']=node['return'];node=node.sibling;}}function commitNestedUnmounts(root){// While we're inside a removed host node we don't want to call
7569// removeChild on the inner nodes because they're removed by the top
7570// call anyway. We also want to call componentWillUnmount on all
7571// composites before this host node is removed from the tree. Therefore

Callers 1

commitAllHostEffectsFunction · 0.85

Calls 3

getHostParentFiberFunction · 0.85
getHostSiblingFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected