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

Function isFiberMountedImpl

code/higher-order-components/public/app.js:5109–5136  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

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