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

Function commitUnmount

code/presentational-and-container/public/app.js:11302–11340  ·  view source on GitHub ↗
(current)

Source from the content-addressed store, hash-verified

11300 // deletion, so don't let them throw. Host-originating errors should
11301 // interrupt deletion, so it's okay
11302 function commitUnmount(current) {
11303 if (typeof onCommitUnmount === 'function') {
11304 onCommitUnmount(current);
11305 }
11306
11307 switch (current.tag) {
11308 case ClassComponent:
11309 {
11310 safelyDetachRef(current);
11311 var _instance6 = current.stateNode;
11312 if (typeof _instance6.componentWillUnmount === 'function') {
11313 safelyCallComponentWillUnmount(current, _instance6);
11314 }
11315 return;
11316 }
11317 case HostComponent:
11318 {
11319 safelyDetachRef(current);
11320 return;
11321 }
11322 case CallComponent:
11323 {
11324 commitNestedUnmounts(current.stateNode);
11325 return;
11326 }
11327 case HostPortal:
11328 {
11329 // TODO: this is recursive.
11330 // We are also not using this parent because
11331 // the portal will get pushed immediately.
11332 if (enableMutatingReconciler && mutation) {
11333 unmountHostComponents(current);
11334 } else if (enablePersistentReconciler && persistence) {
11335 emptyPortalContainer(current);
11336 }
11337 return;
11338 }
11339 }
11340 }
11341
11342 function commitNestedUnmounts(root) {
11343 // 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