detachFiberMutation() — react Function Reference
Architecture documentation for the detachFiberMutation() function in ReactFiberCommitWork.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD ec84cfbd_70a6_4a14_76df_85ddaeb139f7["detachFiberMutation()"] e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"] ec84cfbd_70a6_4a14_76df_85ddaeb139f7 -->|defined in| e0fbfbd5_47b0_a489_0b36_bbfad9245544 13f145c1_d686_f120_13ad_212f75386c29["commitDeletionEffects()"] 13f145c1_d686_f120_13ad_212f75386c29 -->|calls| ec84cfbd_70a6_4a14_76df_85ddaeb139f7 style ec84cfbd_70a6_4a14_76df_85ddaeb139f7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberCommitWork.js lines 1285–1307
function detachFiberMutation(fiber: Fiber) {
// Cut off the return pointer to disconnect it from the tree.
// This enables us to detect and warn against state updates on an unmounted component.
// It also prevents events from bubbling from within disconnected components.
//
// Ideally, we should also clear the child pointer of the parent alternate to let this
// get GC:ed but we don't know which for sure which parent is the current
// one so we'll settle for GC:ing the subtree of this child.
// This child itself will be GC:ed when the parent updates the next time.
//
// Note that we can't clear child or sibling pointers yet.
// They're needed for passive effects and for findDOMNode.
// We defer those fields, and all other cleanup, to the passive phase (see detachFiberAfterEffects).
//
// Don't reset the alternate yet, either. We need that so we can detach the
// alternate's fields in the passive phase. Clearing the return pointer is
// sufficient for findDOMNode semantics.
const alternate = fiber.alternate;
if (alternate !== null) {
alternate.return = null;
}
fiber.return = null;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does detachFiberMutation() do?
detachFiberMutation() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitWork.js.
Where is detachFiberMutation() defined?
detachFiberMutation() is defined in packages/react-reconciler/src/ReactFiberCommitWork.js at line 1285.
What calls detachFiberMutation()?
detachFiberMutation() is called by 1 function(s): commitDeletionEffects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free