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

Function isFiberMountedImpl

code/communication/public/app.js:5150–5177  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

5148var UNMOUNTED = 3;
5149
5150function isFiberMountedImpl(fiber) {
5151 var node = fiber;
5152 if (!fiber.alternate) {
5153 // If there is no alternate, this might be a new tree that isn't inserted
5154 // yet. If it is, then it will have a pending insertion effect on it.
5155 if ((node.effectTag & Placement) !== NoEffect) {
5156 return MOUNTING;
5157 }
5158 while (node['return']) {
5159 node = node['return'];
5160 if ((node.effectTag & Placement) !== NoEffect) {
5161 return MOUNTING;
5162 }
5163 }
5164 } else {
5165 while (node['return']) {
5166 node = node['return'];
5167 }
5168 }
5169 if (node.tag === HostRoot) {
5170 // TODO: Check if this was a nested HostRoot when used with
5171 // renderContainerIntoSubtree.
5172 return MOUNTED;
5173 }
5174 // If we didn't hit the root, that means that we're in an disconnected tree
5175 // that has been unmounted.
5176 return UNMOUNTED;
5177}
5178
5179function isFiberMounted(fiber) {
5180 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