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

Function isFiberMountedImpl

code/controlled-uncontrolled/public/app.js:4439–4466  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

4437var UNMOUNTED = 3;
4438
4439function isFiberMountedImpl(fiber) {
4440 var node = fiber;
4441 if (!fiber.alternate) {
4442 // If there is no alternate, this might be a new tree that isn't inserted
4443 // yet. If it is, then it will have a pending insertion effect on it.
4444 if ((node.effectTag & Placement) !== NoEffect) {
4445 return MOUNTING;
4446 }
4447 while (node['return']) {
4448 node = node['return'];
4449 if ((node.effectTag & Placement) !== NoEffect) {
4450 return MOUNTING;
4451 }
4452 }
4453 } else {
4454 while (node['return']) {
4455 node = node['return'];
4456 }
4457 }
4458 if (node.tag === HostRoot) {
4459 // TODO: Check if this was a nested HostRoot when used with
4460 // renderContainerIntoSubtree.
4461 return MOUNTED;
4462 }
4463 // If we didn't hit the root, that means that we're in an disconnected tree
4464 // that has been unmounted.
4465 return UNMOUNTED;
4466}
4467
4468function isFiberMounted(fiber) {
4469 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