File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
113
113
// If we have two possible branches, we'll walk backwards up to the root
114
114
// to see what path the root points to. On the way we may hit one of the
115
115
// 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 ;
118
118
while ( true ) {
119
119
let parentA = a . return ;
120
120
if ( parentA === null ) {
@@ -127,8 +127,13 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
127
127
// happens when a Suspense component is hidden. An extra fragment fiber
128
128
// is inserted in between the Suspense fiber and its children. Skip
129
129
// 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 ;
132
137
}
133
138
134
139
// If both copies of the parent fiber point to the same child, we can
You can’t perform that action at this time.
0 commit comments