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

Function commitUnmount

code/event-handlers/public/app.js:10759–10797  ·  view source on GitHub ↗
(current)

Source from the content-addressed store, hash-verified

10757 // deletion, so don't let them throw. Host-originating errors should
10758 // interrupt deletion, so it's okay
10759 function commitUnmount(current) {
10760 if (typeof onCommitUnmount === 'function') {
10761 onCommitUnmount(current);
10762 }
10763
10764 switch (current.tag) {
10765 case ClassComponent:
10766 {
10767 safelyDetachRef(current);
10768 var _instance6 = current.stateNode;
10769 if (typeof _instance6.componentWillUnmount === 'function') {
10770 safelyCallComponentWillUnmount(current, _instance6);
10771 }
10772 return;
10773 }
10774 case HostComponent:
10775 {
10776 safelyDetachRef(current);
10777 return;
10778 }
10779 case CallComponent:
10780 {
10781 commitNestedUnmounts(current.stateNode);
10782 return;
10783 }
10784 case HostPortal:
10785 {
10786 // TODO: this is recursive.
10787 // We are also not using this parent because
10788 // the portal will get pushed immediately.
10789 if (enableMutatingReconciler && mutation) {
10790 unmountHostComponents(current);
10791 } else if (enablePersistentReconciler && persistence) {
10792 emptyPortalContainer(current);
10793 }
10794 return;
10795 }
10796 }
10797 }
10798
10799 function commitNestedUnmounts(root) {
10800 // 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