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

Function commitNestedUnmounts

code/communication/public/app.js:11504–11534  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

11502 }
11503
11504 function commitNestedUnmounts(root) {
11505 // While we're inside a removed host node we don't want to call
11506 // removeChild on the inner nodes because they're removed by the top
11507 // call anyway. We also want to call componentWillUnmount on all
11508 // composites before this host node is removed from the tree. Therefore
11509 var node = root;
11510 while (true) {
11511 commitUnmount(node);
11512 // Visit children because they may contain more composite or host nodes.
11513 // Skip portals because commitUnmount() currently visits them recursively.
11514 if (node.child !== null && (
11515 // If we use mutation we drill down into portals using commitUnmount above.
11516 // If we don't use mutation we drill down into portals here instead.
11517 !mutation || node.tag !== HostPortal)) {
11518 node.child['return'] = node;
11519 node = node.child;
11520 continue;
11521 }
11522 if (node === root) {
11523 return;
11524 }
11525 while (node.sibling === null) {
11526 if (node['return'] === null || node['return'] === root) {
11527 return;
11528 }
11529 node = node['return'];
11530 }
11531 node.sibling['return'] = node['return'];
11532 node = node.sibling;
11533 }
11534 }
11535
11536 function detachFiber(current) {
11537 // 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