MCPcopy Index your code
hub / github.com/microsoft/SandDance / commitNestedUnmounts

Function commitNestedUnmounts

docs/external/js/react-dom.development.js:20289–20324  ·  view source on GitHub ↗
(finishedRoot, root, renderPriorityLevel)

Source from the content-addressed store, hash-verified

20287 }
20288
20289 function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
20290 // While we're inside a removed host node we don't want to call
20291 // removeChild on the inner nodes because they're removed by the top
20292 // call anyway. We also want to call componentWillUnmount on all
20293 // composites before this host node is removed from the tree. Therefore
20294 // we do an inner loop while we're still inside the host node.
20295 var node = root;
20296
20297 while (true) {
20298 commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes.
20299 // Skip portals because commitUnmount() currently visits them recursively.
20300
20301 if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
20302 // If we don't use mutation we drill down into portals here instead.
20303 node.tag !== HostPortal)) {
20304 node.child.return = node;
20305 node = node.child;
20306 continue;
20307 }
20308
20309 if (node === root) {
20310 return;
20311 }
20312
20313 while (node.sibling === null) {
20314 if (node.return === null || node.return === root) {
20315 return;
20316 }
20317
20318 node = node.return;
20319 }
20320
20321 node.sibling.return = node.return;
20322 node = node.sibling;
20323 }
20324 }
20325
20326 function detachFiber(current) {
20327 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