Add invariant

Defensive coding to prevent an infinite loop.
This commit is contained in:
Andrew Clark committed 2017-01-31 11:35:10 -08:00
1 parent 97f6786cba
commit ba5b9c0af3
1 file changed
+7
@@ -168,17 +168,24 @@ function findCurrentFiberUsingSlowPath(fiber : Fiber) : Fiber | null {
child = parentB.child;
while (child) {
if (child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
child = child.sibling;
}
invariant(
didFindChild,
'Child was not found in either parent set. This indicates a bug ' +
'related to the return pointer.'
);
}
}