mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add invariant
Defensive coding to prevent an infinite loop.
This commit is contained in:
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.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user