MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / commitNestedUnmounts

Function commitNestedUnmounts

code/styling/public/app.js:11469–11499  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

11467 }
11468
11469 function commitNestedUnmounts(root) {
11470 // While we're inside a removed host node we don't want to call
11471 // removeChild on the inner nodes because they're removed by the top
11472 // call anyway. We also want to call componentWillUnmount on all
11473 // composites before this host node is removed from the tree. Therefore
11474 var node = root;
11475 while (true) {
11476 commitUnmount(node);
11477 // Visit children because they may contain more composite or host nodes.
11478 // Skip portals because commitUnmount() currently visits them recursively.
11479 if (node.child !== null && (
11480 // If we use mutation we drill down into portals using commitUnmount above.
11481 // If we don't use mutation we drill down into portals here instead.
11482 !mutation || node.tag !== HostPortal)) {
11483 node.child['return'] = node;
11484 node = node.child;
11485 continue;
11486 }
11487 if (node === root) {
11488 return;
11489 }
11490 while (node.sibling === null) {
11491 if (node['return'] === null || node['return'] === root) {
11492 return;
11493 }
11494 node = node['return'];
11495 }
11496 node.sibling['return'] = node['return'];
11497 node = node.sibling;
11498 }
11499 }
11500
11501 function detachFiber(current) {
11502 // Cut off the return pointers to disconnect it from the tree. Ideally, we

Callers 3

commitUnmountFunction · 0.70
ReactFiberCommitWorkFunction · 0.70
unmountHostComponentsFunction · 0.70

Calls 1

commitUnmountFunction · 0.70

Tested by

no test coverage detected