Skip to content

Commit 982252d

Browse files
committed
Fix type refinement
1 parent fe150e4 commit 982252d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/react-reconciler/src/ReactFiberTreeReflection.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
113113
// If we have two possible branches, we'll walk backwards up to the root
114114
// to see what path the root points to. On the way we may hit one of the
115115
// special cases and we'll deal with them.
116-
let a = fiber;
117-
let b = alternate;
116+
let a: Fiber = fiber;
117+
let b: Fiber = alternate;
118118
while (true) {
119119
let parentA = a.return;
120120
if (parentA === null) {
@@ -127,8 +127,13 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
127127
// happens when a Suspense component is hidden. An extra fragment fiber
128128
// is inserted in between the Suspense fiber and its children. Skip
129129
// over this extra fragment fiber and proceed to the next parent.
130-
a = parentA.return;
131-
continue;
130+
const nextParent = parentA.return;
131+
if (nextParent !== null) {
132+
a = b = nextParent;
133+
continue;
134+
}
135+
// If there's no parent, we're at the root.
136+
break;
132137
}
133138

134139
// If both copies of the parent fiber point to the same child, we can

0 commit comments

Comments
 (0)