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

Function isFiberMountedImpl

code/dependency-injection/public/app.js:5208–5235  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

5206var UNMOUNTED = 3;
5207
5208function isFiberMountedImpl(fiber) {
5209 var node = fiber;
5210 if (!fiber.alternate) {
5211 // If there is no alternate, this might be a new tree that isn't inserted
5212 // yet. If it is, then it will have a pending insertion effect on it.
5213 if ((node.effectTag & Placement) !== NoEffect) {
5214 return MOUNTING;
5215 }
5216 while (node['return']) {
5217 node = node['return'];
5218 if ((node.effectTag & Placement) !== NoEffect) {
5219 return MOUNTING;
5220 }
5221 }
5222 } else {
5223 while (node['return']) {
5224 node = node['return'];
5225 }
5226 }
5227 if (node.tag === HostRoot) {
5228 // TODO: Check if this was a nested HostRoot when used with
5229 // renderContainerIntoSubtree.
5230 return MOUNTED;
5231 }
5232 // If we didn't hit the root, that means that we're in an disconnected tree
5233 // that has been unmounted.
5234 return UNMOUNTED;
5235}
5236
5237function isFiberMounted(fiber) {
5238 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