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

Function commitUnmount

code/controlled-uncontrolled/public/app.js:10753–10791  ·  view source on GitHub ↗
(current)

Source from the content-addressed store, hash-verified

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