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

Function commitNestedUnmounts

code/third-party/public/app.js:10702–10732  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

10700 }
10701
10702 function commitNestedUnmounts(root) {
10703 // While we're inside a removed host node we don't want to call
10704 // removeChild on the inner nodes because they're removed by the top
10705 // call anyway. We also want to call componentWillUnmount on all
10706 // composites before this host node is removed from the tree. Therefore
10707 var node = root;
10708 while (true) {
10709 commitUnmount(node);
10710 // Visit children because they may contain more composite or host nodes.
10711 // Skip portals because commitUnmount() currently visits them recursively.
10712 if (node.child !== null && (
10713 // If we use mutation we drill down into portals using commitUnmount above.
10714 // If we don't use mutation we drill down into portals here instead.
10715 !mutation || node.tag !== HostPortal)) {
10716 node.child['return'] = node;
10717 node = node.child;
10718 continue;
10719 }
10720 if (node === root) {
10721 return;
10722 }
10723 while (node.sibling === null) {
10724 if (node['return'] === null || node['return'] === root) {
10725 return;
10726 }
10727 node = node['return'];
10728 }
10729 node.sibling['return'] = node['return'];
10730 node = node.sibling;
10731 }
10732 }
10733
10734 function detachFiber(current) {
10735 // 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