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

Function commitNestedUnmounts

code/new-context-api/public/app.js:10830–10860  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

10828 }
10829
10830 function commitNestedUnmounts(root) {
10831 // While we're inside a removed host node we don't want to call
10832 // removeChild on the inner nodes because they're removed by the top
10833 // call anyway. We also want to call componentWillUnmount on all
10834 // composites before this host node is removed from the tree. Therefore
10835 var node = root;
10836 while (true) {
10837 commitUnmount(node);
10838 // Visit children because they may contain more composite or host nodes.
10839 // Skip portals because commitUnmount() currently visits them recursively.
10840 if (node.child !== null && (
10841 // If we use mutation we drill down into portals using commitUnmount above.
10842 // If we don't use mutation we drill down into portals here instead.
10843 !mutation || node.tag !== HostPortal)) {
10844 node.child['return'] = node;
10845 node = node.child;
10846 continue;
10847 }
10848 if (node === root) {
10849 return;
10850 }
10851 while (node.sibling === null) {
10852 if (node['return'] === null || node['return'] === root) {
10853 return;
10854 }
10855 node = node['return'];
10856 }
10857 node.sibling['return'] = node['return'];
10858 node = node.sibling;
10859 }
10860 }
10861
10862 function detachFiber(current) {
10863 // 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