MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / isFiberMountedImpl

Function isFiberMountedImpl

code/new-context-api/public/app.js:4476–4503  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

4474var UNMOUNTED = 3;
4475
4476function isFiberMountedImpl(fiber) {
4477 var node = fiber;
4478 if (!fiber.alternate) {
4479 // If there is no alternate, this might be a new tree that isn't inserted
4480 // yet. If it is, then it will have a pending insertion effect on it.
4481 if ((node.effectTag & Placement) !== NoEffect) {
4482 return MOUNTING;
4483 }
4484 while (node['return']) {
4485 node = node['return'];
4486 if ((node.effectTag & Placement) !== NoEffect) {
4487 return MOUNTING;
4488 }
4489 }
4490 } else {
4491 while (node['return']) {
4492 node = node['return'];
4493 }
4494 }
4495 if (node.tag === HostRoot) {
4496 // TODO: Check if this was a nested HostRoot when used with
4497 // renderContainerIntoSubtree.
4498 return MOUNTED;
4499 }
4500 // If we didn't hit the root, that means that we're in an disconnected tree
4501 // that has been unmounted.
4502 return UNMOUNTED;
4503}
4504
4505function isFiberMounted(fiber) {
4506 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