@@ -21,8 +21,6 @@ import {
2121 HostRoot ,
2222 HostPortal ,
2323 HostText ,
24- Fragment ,
25- SuspenseComponent ,
2624} from 'shared/ReactWorkTags' ;
2725import { NoEffect , Placement } from 'shared/ReactSideEffectTags' ;
2826
@@ -119,29 +117,18 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null {
119117 let b = alternate ;
120118 while ( true ) {
121119 let parentA = a . return ;
122- let parentB = parentA ? parentA . alternate : null ;
123- if ( ! parentA || ! parentB ) {
124- // We're either at the root, or we're in a special Fragment
125- // with no alternate, which is how Suspense (un)hiding works.
126- let maybeSuspenseFragment = parentA || parentB ;
127- if ( maybeSuspenseFragment && maybeSuspenseFragment . tag === Fragment ) {
128- const maybeSuspense = maybeSuspenseFragment . return ;
129- if (
130- maybeSuspense &&
131- maybeSuspense . tag === SuspenseComponent &&
132- // If state isn't null, it timed out and we have two Fragment children.
133- maybeSuspense . memoizedState !== null
134- ) {
135- parentA = maybeSuspense ;
136- parentB = maybeSuspense ;
137- a = maybeSuspenseFragment ;
138- b = maybeSuspenseFragment ;
139- } else {
140- break ;
141- }
142- } else {
143- break ;
144- }
120+ if ( parentA === null ) {
121+ // We're at the root.
122+ break ;
123+ }
124+ let parentB = parentA . alternate ;
125+ if ( parentB === null ) {
126+ // There is no alternate. This is an unusual case. Currently, it only
127+ // happens when a Suspense component is hidden. An extra fragment fiber
128+ // is inserted in between the Suspense fiber and its children. Skip
129+ // over this extra fragment fiber and proceed to the next parent.
130+ a = parentA . return ;
131+ continue ;
145132 }
146133
147134 // If both copies of the parent fiber point to the same child, we can
0 commit comments