Skip to content

Commit

Permalink
Fix type refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Apr 3, 2019
1 parent fe150e4 commit 982252d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/react-reconciler/src/ReactFiberTreeReflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
// If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
let a = fiber;
let b = alternate;
let a: Fiber = fiber;
let b: Fiber = alternate;
while (true) {
let parentA = a.return;
if (parentA === null) {
Expand All @@ -127,8 +127,13 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
// happens when a Suspense component is hidden. An extra fragment fiber
// is inserted in between the Suspense fiber and its children. Skip
// over this extra fragment fiber and proceed to the next parent.
a = parentA.return;
continue;
const nextParent = parentA.return;
if (nextParent !== null) {
a = b = nextParent;
continue;
}
// If there's no parent, we're at the root.
break;
}

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

0 comments on commit 982252d

Please sign in to comment.