MCPcopy Create free account
hub / github.com/plotly/dash / commitDeletionEffectsOnFiber

Function commitDeletionEffectsOnFiber

dash/deps/react-dom@18.3.1.js:24043–24223  ·  view source on GitHub ↗
(finishedRoot, nearestMountedAncestor, deletedFiber)

Source from the content-addressed store, hash-verified

24041 }
24042
24043 function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) {
24044 onCommitUnmount(deletedFiber); // The cases in this outer switch modify the stack before they traverse
24045 // into their subtree. There are simpler cases in the inner switch
24046 // that don't modify the stack.
24047
24048 switch (deletedFiber.tag) {
24049 case HostComponent:
24050 {
24051 if (!offscreenSubtreeWasHidden) {
24052 safelyDetachRef(deletedFiber, nearestMountedAncestor);
24053 } // Intentional fallthrough to next branch
24054
24055 }
24056 // eslint-disable-next-line-no-fallthrough
24057
24058 case HostText:
24059 {
24060 // We only need to remove the nearest host child. Set the host parent
24061 // to `null` on the stack to indicate that nested children don't
24062 // need to be removed.
24063 {
24064 var prevHostParent = hostParent;
24065 var prevHostParentIsContainer = hostParentIsContainer;
24066 hostParent = null;
24067 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
24068 hostParent = prevHostParent;
24069 hostParentIsContainer = prevHostParentIsContainer;
24070
24071 if (hostParent !== null) {
24072 // Now that all the child effects have unmounted, we can remove the
24073 // node from the tree.
24074 if (hostParentIsContainer) {
24075 removeChildFromContainer(hostParent, deletedFiber.stateNode);
24076 } else {
24077 removeChild(hostParent, deletedFiber.stateNode);
24078 }
24079 }
24080 }
24081
24082 return;
24083 }
24084
24085 case DehydratedFragment:
24086 {
24087 // Delete the dehydrated suspense boundary and all of its content.
24088
24089
24090 {
24091 if (hostParent !== null) {
24092 if (hostParentIsContainer) {
24093 clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode);
24094 } else {
24095 clearSuspenseBoundary(hostParent, deletedFiber.stateNode);
24096 }
24097 }
24098 }
24099
24100 return;

Callers 2

commitDeletionEffectsFunction · 0.70

Calls 13

onCommitUnmountFunction · 0.70
safelyDetachRefFunction · 0.70
removeChildFromContainerFunction · 0.70
removeChildFunction · 0.70
clearSuspenseBoundaryFunction · 0.70
safelyCallDestroyFunction · 0.70
startLayoutEffectTimerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…