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

Function commitNestedUnmounts

bundle.js:7568–7574  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

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
7572var node=root;while(true){commitUnmount(node);// Visit children because they may contain more composite or host nodes.
7573// Skip portals because commitUnmount() currently visits them recursively.
7574if(node.child!==null&&node.tag!==HostPortal$7){node.child['return']=node;node=node.child;continue;}if(node===root){return;}while(node.sibling===null){if(node['return']===null||node['return']===root){return;}node=node['return'];}node.sibling['return']=node['return'];node=node.sibling;}}function unmountHostComponents(current){// We only have the top Fiber that was inserted but we need recurse down its
7575var node=current;// Each iteration, currentParent is populated with node's host parent if not
7576// currentParentIsValid.
7577var currentParentIsValid=false;var currentParent=void 0;var currentParentIsContainer=void 0;while(true){if(!currentParentIsValid){var parent=node['return'];findParent:while(true){!(parent!==null)?invariant(false,'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'):void 0;switch(parent.tag){case HostComponent$9:currentParent=parent.stateNode;currentParentIsContainer=false;break findParent;case HostRoot$9:currentParent=parent.stateNode.containerInfo;currentParentIsContainer=true;break findParent;case HostPortal$7:currentParent=parent.stateNode.containerInfo;currentParentIsContainer=true;break findParent;}parent=parent['return'];}currentParentIsValid=true;}if(node.tag===HostComponent$9||node.tag===HostText$7){commitNestedUnmounts(node);// After all the children have unmounted, it is now safe to remove the

Callers 2

unmountHostComponentsFunction · 0.85
commitUnmountFunction · 0.85

Calls 1

commitUnmountFunction · 0.85

Tested by

no test coverage detected