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

Function isFiberMountedImpl

code/styling/public/app.js:5115–5142  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

5113var UNMOUNTED = 3;
5114
5115function isFiberMountedImpl(fiber) {
5116 var node = fiber;
5117 if (!fiber.alternate) {
5118 // If there is no alternate, this might be a new tree that isn't inserted
5119 // yet. If it is, then it will have a pending insertion effect on it.
5120 if ((node.effectTag & Placement) !== NoEffect) {
5121 return MOUNTING;
5122 }
5123 while (node['return']) {
5124 node = node['return'];
5125 if ((node.effectTag & Placement) !== NoEffect) {
5126 return MOUNTING;
5127 }
5128 }
5129 } else {
5130 while (node['return']) {
5131 node = node['return'];
5132 }
5133 }
5134 if (node.tag === HostRoot) {
5135 // TODO: Check if this was a nested HostRoot when used with
5136 // renderContainerIntoSubtree.
5137 return MOUNTED;
5138 }
5139 // If we didn't hit the root, that means that we're in an disconnected tree
5140 // that has been unmounted.
5141 return UNMOUNTED;
5142}
5143
5144function isFiberMounted(fiber) {
5145 return isFiberMountedImpl(fiber) === MOUNTED;

Callers 4

isFiberMountedFunction · 0.70
isMountedFunction · 0.70
assertIsMountedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected