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

Function commitNestedUnmounts

code/composition/public/app.js:11607–11637  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

11605 }
11606
11607 function commitNestedUnmounts(root) {
11608 // While we're inside a removed host node we don't want to call
11609 // removeChild on the inner nodes because they're removed by the top
11610 // call anyway. We also want to call componentWillUnmount on all
11611 // composites before this host node is removed from the tree. Therefore
11612 var node = root;
11613 while (true) {
11614 commitUnmount(node);
11615 // Visit children because they may contain more composite or host nodes.
11616 // Skip portals because commitUnmount() currently visits them recursively.
11617 if (node.child !== null && (
11618 // If we use mutation we drill down into portals using commitUnmount above.
11619 // If we don't use mutation we drill down into portals here instead.
11620 !mutation || node.tag !== HostPortal)) {
11621 node.child['return'] = node;
11622 node = node.child;
11623 continue;
11624 }
11625 if (node === root) {
11626 return;
11627 }
11628 while (node.sibling === null) {
11629 if (node['return'] === null || node['return'] === root) {
11630 return;
11631 }
11632 node = node['return'];
11633 }
11634 node.sibling['return'] = node['return'];
11635 node = node.sibling;
11636 }
11637 }
11638
11639 function detachFiber(current) {
11640 // 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