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

Function commitNestedUnmounts

lib/assets/react-source/development/react.js:23849–23884  ·  view source on GitHub ↗
(finishedRoot, root, renderPriorityLevel)

Source from the content-addressed store, hash-verified

23847 }
23848
23849 function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
23850 // While we're inside a removed host node we don't want to call
23851 // removeChild on the inner nodes because they're removed by the top
23852 // call anyway. We also want to call componentWillUnmount on all
23853 // composites before this host node is removed from the tree. Therefore
23854 // we do an inner loop while we're still inside the host node.
23855 var node = root;
23856
23857 while (true) {
23858 commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes.
23859 // Skip portals because commitUnmount() currently visits them recursively.
23860
23861 if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
23862 // If we don't use mutation we drill down into portals here instead.
23863 node.tag !== HostPortal)) {
23864 node.child.return = node;
23865 node = node.child;
23866 continue;
23867 }
23868
23869 if (node === root) {
23870 return;
23871 }
23872
23873 while (node.sibling === null) {
23874 if (node.return === null || node.return === root) {
23875 return;
23876 }
23877
23878 node = node.return;
23879 }
23880
23881 node.sibling.return = node.return;
23882 node = node.sibling;
23883 }
23884 }
23885
23886 function detachFiber(current) {
23887 var alternate = current.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we

Callers 1

unmountHostComponentsFunction · 0.85

Calls 1

commitUnmountFunction · 0.85

Tested by

no test coverage detected