@samitouri / QOS-React / commits / 1c7c38c82a

Remove extra loop (?) (#11889)

* Remove extra loop (?) * prettier

Jason Quense committed Jan 5, 2018 at 13:35 UTC 1c7c38c82af1c4d9985c3dd1e2b1a4d996bd6f66
1 file changed +1 -8
packages/react-dom/src/client/ReactDOMComponentTree.js
+1 -8
@@ -27,10 +27,7 @@ export function getClosestInstanceFromNode(node) {
27 return node[internalInstanceKey];
28 }
29
30 - // Walk up the tree until we find an ancestor whose instance we have cached.
31 - let parents = [];
30 while (!node[internalInstanceKey]) {
33 - parents.push(node);
31 if (node.parentNode) {
32 node = node.parentNode;
33 } else {
@@ -40,17 +37,13 @@ export function getClosestInstanceFromNode(node) {
37 }
38 }
39
43 - let closest;
40 let inst = node[internalInstanceKey];
41 if (inst.tag === HostComponent || inst.tag === HostText) {
42 // In Fiber, this will always be the deepest root.
43 return inst;
44 }
49 - for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
50 - closest = inst;
51 - }
45
53 - return closest;
46 + return null;
47 }
48
49 /**