Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit d5901f3

Browse files
FIX: addComponent was getting called for the same component multiple times causing after.js to get stuck in an infinite loop
1 parent 7b4e13d commit d5901f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function getCommonParent(nodes) {
4646
});
4747
}
4848
}
49-
return path[path.length - 1];
49+
return path ? path[path.length - 1] : document;
5050
}
5151

5252
function logElement(node, logFn) {
@@ -186,7 +186,8 @@ function componentAfterRender(component) {
186186
}
187187

188188
function addComponent(component) {
189-
if (component._reactInternalInstance) {
189+
var reactInstance = component._reactInternalInstance;
190+
if (reactInstance && !components[reactInstance._debugID]) {
190191
components[component._reactInternalInstance._debugID] = component;
191192
componentAfterRender(component);
192193
}

0 commit comments

Comments
 (0)