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

Function commitUnmount

code/new-context-api/public/app.js:10790–10828  ·  view source on GitHub ↗
(current)

Source from the content-addressed store, hash-verified

10788 // deletion, so don't let them throw. Host-originating errors should
10789 // interrupt deletion, so it's okay
10790 function commitUnmount(current) {
10791 if (typeof onCommitUnmount === 'function') {
10792 onCommitUnmount(current);
10793 }
10794
10795 switch (current.tag) {
10796 case ClassComponent:
10797 {
10798 safelyDetachRef(current);
10799 var _instance6 = current.stateNode;
10800 if (typeof _instance6.componentWillUnmount === 'function') {
10801 safelyCallComponentWillUnmount(current, _instance6);
10802 }
10803 return;
10804 }
10805 case HostComponent:
10806 {
10807 safelyDetachRef(current);
10808 return;
10809 }
10810 case CallComponent:
10811 {
10812 commitNestedUnmounts(current.stateNode);
10813 return;
10814 }
10815 case HostPortal:
10816 {
10817 // TODO: this is recursive.
10818 // We are also not using this parent because
10819 // the portal will get pushed immediately.
10820 if (enableMutatingReconciler && mutation) {
10821 unmountHostComponents(current);
10822 } else if (enablePersistentReconciler && persistence) {
10823 emptyPortalContainer(current);
10824 }
10825 return;
10826 }
10827 }
10828 }
10829
10830 function commitNestedUnmounts(root) {
10831 // 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