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

Function findRootContainerNode

code/composition/public/app.js:5934–5946  ·  view source on GitHub ↗

* Find the deepest React component completely containing the root of the * passed-in instance (for use when entire React trees are nested within each * other). If React trees are not nested, returns null.

(inst)

Source from the content-addressed store, hash-verified

5932 * other). If React trees are not nested, returns null.
5933 */
5934function findRootContainerNode(inst) {
5935 // TODO: It may be a good idea to cache this to prevent unnecessary DOM
5936 // traversal, but caching is difficult to do correctly without using a
5937 // mutation observer to listen for all DOM changes.
5938 while (inst['return']) {
5939 inst = inst['return'];
5940 }
5941 if (inst.tag !== HostRoot) {
5942 // This can happen if we're in a detached tree.
5943 return null;
5944 }
5945 return inst.stateNode.containerInfo;
5946}
5947
5948// Used to store ancestor hierarchy in top level callback
5949function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {

Callers 1

handleTopLevelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected