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

Function commitNestedUnmounts

code/redux/public/app.js:11720–11750  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

11718 }
11719
11720 function commitNestedUnmounts(root) {
11721 // While we're inside a removed host node we don't want to call
11722 // removeChild on the inner nodes because they're removed by the top
11723 // call anyway. We also want to call componentWillUnmount on all
11724 // composites before this host node is removed from the tree. Therefore
11725 var node = root;
11726 while (true) {
11727 commitUnmount(node);
11728 // Visit children because they may contain more composite or host nodes.
11729 // Skip portals because commitUnmount() currently visits them recursively.
11730 if (node.child !== null && (
11731 // If we use mutation we drill down into portals using commitUnmount above.
11732 // If we don't use mutation we drill down into portals here instead.
11733 !mutation || node.tag !== HostPortal)) {
11734 node.child['return'] = node;
11735 node = node.child;
11736 continue;
11737 }
11738 if (node === root) {
11739 return;
11740 }
11741 while (node.sibling === null) {
11742 if (node['return'] === null || node['return'] === root) {
11743 return;
11744 }
11745 node = node['return'];
11746 }
11747 node.sibling['return'] = node['return'];
11748 node = node.sibling;
11749 }
11750 }
11751
11752 function detachFiber(current) {
11753 // 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