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

Function commitNestedUnmounts

code/event-handlers/public/app.js:10799–10829  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

10797 }
10798
10799 function commitNestedUnmounts(root) {
10800 // While we're inside a removed host node we don't want to call
10801 // removeChild on the inner nodes because they're removed by the top
10802 // call anyway. We also want to call componentWillUnmount on all
10803 // composites before this host node is removed from the tree. Therefore
10804 var node = root;
10805 while (true) {
10806 commitUnmount(node);
10807 // Visit children because they may contain more composite or host nodes.
10808 // Skip portals because commitUnmount() currently visits them recursively.
10809 if (node.child !== null && (
10810 // If we use mutation we drill down into portals using commitUnmount above.
10811 // If we don't use mutation we drill down into portals here instead.
10812 !mutation || node.tag !== HostPortal)) {
10813 node.child['return'] = node;
10814 node = node.child;
10815 continue;
10816 }
10817 if (node === root) {
10818 return;
10819 }
10820 while (node.sibling === null) {
10821 if (node['return'] === null || node['return'] === root) {
10822 return;
10823 }
10824 node = node['return'];
10825 }
10826 node.sibling['return'] = node['return'];
10827 node = node.sibling;
10828 }
10829 }
10830
10831 function detachFiber(current) {
10832 // 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