detachAlternateSiblings() — react Function Reference
Architecture documentation for the detachAlternateSiblings() function in ReactFiberCommitWork.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 0aa36201_b90a_3656_4a51_312954ee1f8a["detachAlternateSiblings()"] e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"] 0aa36201_b90a_3656_4a51_312954ee1f8a -->|defined in| e0fbfbd5_47b0_a489_0b36_bbfad9245544 e3c426a6_d017_fba5_0e94_3a1169983c80["recursivelyTraversePassiveUnmountEffects()"] e3c426a6_d017_fba5_0e94_3a1169983c80 -->|calls| 0aa36201_b90a_3656_4a51_312954ee1f8a style 0aa36201_b90a_3656_4a51_312954ee1f8a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberCommitWork.js lines 4771–4797
function detachAlternateSiblings(parentFiber: Fiber) {
// A fiber was deleted from this parent fiber, but it's still part of the
// previous (alternate) parent fiber's list of children. Because children
// are a linked list, an earlier sibling that's still alive will be
// connected to the deleted fiber via its `alternate`:
//
// live fiber --alternate--> previous live fiber --sibling--> deleted
// fiber
//
// We can't disconnect `alternate` on nodes that haven't been deleted yet,
// but we can disconnect the `sibling` and `child` pointers.
const previousFiber = parentFiber.alternate;
if (previousFiber !== null) {
let detachedChild = previousFiber.child;
if (detachedChild !== null) {
previousFiber.child = null;
do {
// $FlowFixMe[incompatible-use] found when upgrading Flow
const detachedSibling = detachedChild.sibling;
// $FlowFixMe[incompatible-use] found when upgrading Flow
detachedChild.sibling = null;
detachedChild = detachedSibling;
} while (detachedChild !== null);
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does detachAlternateSiblings() do?
detachAlternateSiblings() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitWork.js.
Where is detachAlternateSiblings() defined?
detachAlternateSiblings() is defined in packages/react-reconciler/src/ReactFiberCommitWork.js at line 4771.
What calls detachAlternateSiblings()?
detachAlternateSiblings() is called by 1 function(s): recursivelyTraversePassiveUnmountEffects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free