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

Function isFiberMountedImpl

code/third-party/public/app.js:4348–4375  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

4346var UNMOUNTED = 3;
4347
4348function isFiberMountedImpl(fiber) {
4349 var node = fiber;
4350 if (!fiber.alternate) {
4351 // If there is no alternate, this might be a new tree that isn't inserted
4352 // yet. If it is, then it will have a pending insertion effect on it.
4353 if ((node.effectTag & Placement) !== NoEffect) {
4354 return MOUNTING;
4355 }
4356 while (node['return']) {
4357 node = node['return'];
4358 if ((node.effectTag & Placement) !== NoEffect) {
4359 return MOUNTING;
4360 }
4361 }
4362 } else {
4363 while (node['return']) {
4364 node = node['return'];
4365 }
4366 }
4367 if (node.tag === HostRoot) {
4368 // TODO: Check if this was a nested HostRoot when used with
4369 // renderContainerIntoSubtree.
4370 return MOUNTED;
4371 }
4372 // If we didn't hit the root, that means that we're in an disconnected tree
4373 // that has been unmounted.
4374 return UNMOUNTED;
4375}
4376
4377function isFiberMounted(fiber) {
4378 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