MCPcopy
hub / github.com/tastejs/todomvc / findCurrentHostFiber

Function findCurrentHostFiber

examples/typescript-react/js/bundle.js:5049–5080  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

5047}
5048
5049function findCurrentHostFiber(parent) {
5050 var currentParent = findCurrentFiberUsingSlowPath(parent);
5051 if (!currentParent) {
5052 return null;
5053 }
5054
5055 // Next we'll drill down this component to find the first HostComponent/Text.
5056 var node = currentParent;
5057 while (true) {
5058 if (node.tag === HostComponent || node.tag === HostText) {
5059 return node;
5060 } else if (node.child) {
5061 node.child.return = node;
5062 node = node.child;
5063 continue;
5064 }
5065 if (node === currentParent) {
5066 return null;
5067 }
5068 while (!node.sibling) {
5069 if (!node.return || node.return === currentParent) {
5070 return null;
5071 }
5072 node = node.return;
5073 }
5074 node.sibling.return = node.return;
5075 node = node.sibling;
5076 }
5077 // Flow needs the return null here, but ESLint complains about it.
5078 // eslint-disable-next-line no-unreachable
5079 return null;
5080}
5081
5082function findCurrentHostFiberWithNoPortals(parent) {
5083 var currentParent = findCurrentFiberUsingSlowPath(parent);

Callers 3

findHostInstanceFunction · 0.85
injectIntoDevToolsFunction · 0.85

Calls 1

Tested by

no test coverage detected