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

Function commitUnmount

code/communication/public/app.js:11464–11502  ·  view source on GitHub ↗
(current)

Source from the content-addressed store, hash-verified

11462 // deletion, so don't let them throw. Host-originating errors should
11463 // interrupt deletion, so it's okay
11464 function commitUnmount(current) {
11465 if (typeof onCommitUnmount === 'function') {
11466 onCommitUnmount(current);
11467 }
11468
11469 switch (current.tag) {
11470 case ClassComponent:
11471 {
11472 safelyDetachRef(current);
11473 var _instance6 = current.stateNode;
11474 if (typeof _instance6.componentWillUnmount === 'function') {
11475 safelyCallComponentWillUnmount(current, _instance6);
11476 }
11477 return;
11478 }
11479 case HostComponent:
11480 {
11481 safelyDetachRef(current);
11482 return;
11483 }
11484 case CallComponent:
11485 {
11486 commitNestedUnmounts(current.stateNode);
11487 return;
11488 }
11489 case HostPortal:
11490 {
11491 // TODO: this is recursive.
11492 // We are also not using this parent because
11493 // the portal will get pushed immediately.
11494 if (enableMutatingReconciler && mutation) {
11495 unmountHostComponents(current);
11496 } else if (enablePersistentReconciler && persistence) {
11497 emptyPortalContainer(current);
11498 }
11499 return;
11500 }
11501 }
11502 }
11503
11504 function commitNestedUnmounts(root) {
11505 // While we're inside a removed host node we don't want to call

Callers 2

commitNestedUnmountsFunction · 0.70
unmountHostComponentsFunction · 0.70

Calls 5

onCommitUnmountFunction · 0.70
safelyDetachRefFunction · 0.70
commitNestedUnmountsFunction · 0.70
unmountHostComponentsFunction · 0.70

Tested by

no test coverage detected