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

Function commitNestedUnmounts

code/dependency-injection/public/app.js:11562–11592  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

11560 }
11561
11562 function commitNestedUnmounts(root) {
11563 // While we're inside a removed host node we don't want to call
11564 // removeChild on the inner nodes because they're removed by the top
11565 // call anyway. We also want to call componentWillUnmount on all
11566 // composites before this host node is removed from the tree. Therefore
11567 var node = root;
11568 while (true) {
11569 commitUnmount(node);
11570 // Visit children because they may contain more composite or host nodes.
11571 // Skip portals because commitUnmount() currently visits them recursively.
11572 if (node.child !== null && (
11573 // If we use mutation we drill down into portals using commitUnmount above.
11574 // If we don't use mutation we drill down into portals here instead.
11575 !mutation || node.tag !== HostPortal)) {
11576 node.child['return'] = node;
11577 node = node.child;
11578 continue;
11579 }
11580 if (node === root) {
11581 return;
11582 }
11583 while (node.sibling === null) {
11584 if (node['return'] === null || node['return'] === root) {
11585 return;
11586 }
11587 node = node['return'];
11588 }
11589 node.sibling['return'] = node['return'];
11590 node = node.sibling;
11591 }
11592 }
11593
11594 function detachFiber(current) {
11595 // 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