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 {
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
You can’t perform that action at this time.
0 commit comments