@@ -2182,58 +2182,59 @@ function commitDeletionEffectsOnFiber(
2182
2182
case ForwardRef :
2183
2183
case MemoComponent :
2184
2184
case SimpleMemoComponent : {
2185
- if ( ! offscreenSubtreeWasHidden ) {
2186
- const updateQueue : FunctionComponentUpdateQueue | null =
2187
- ( deletedFiber . updateQueue : any ) ;
2188
- if ( updateQueue !== null ) {
2189
- const lastEffect = updateQueue . lastEffect ;
2190
- if ( lastEffect !== null ) {
2191
- const firstEffect = lastEffect . next ;
2192
-
2193
- let effect = firstEffect ;
2194
- do {
2195
- const tag = effect . tag ;
2196
- const inst = effect . inst ;
2197
- const destroy = inst . destroy ;
2198
- if ( destroy !== undefined ) {
2199
- if ( ( tag & HookInsertion ) !== NoHookEffect ) {
2185
+ const updateQueue : FunctionComponentUpdateQueue | null =
2186
+ ( deletedFiber . updateQueue : any ) ;
2187
+ if ( updateQueue !== null ) {
2188
+ const lastEffect = updateQueue . lastEffect ;
2189
+ if ( lastEffect !== null ) {
2190
+ const firstEffect = lastEffect . next ;
2191
+
2192
+ let effect = firstEffect ;
2193
+ do {
2194
+ const tag = effect . tag ;
2195
+ const inst = effect . inst ;
2196
+ const destroy = inst . destroy ;
2197
+ if ( destroy !== undefined ) {
2198
+ if ( ( tag & HookInsertion ) !== NoHookEffect ) {
2199
+ inst . destroy = undefined ;
2200
+ safelyCallDestroy (
2201
+ deletedFiber ,
2202
+ nearestMountedAncestor ,
2203
+ destroy ,
2204
+ ) ;
2205
+ } else if (
2206
+ ! offscreenSubtreeWasHidden &&
2207
+ ( tag & HookLayout ) !== NoHookEffect
2208
+ ) {
2209
+ if ( enableSchedulingProfiler ) {
2210
+ markComponentLayoutEffectUnmountStarted ( deletedFiber ) ;
2211
+ }
2212
+
2213
+ if ( shouldProfile ( deletedFiber ) ) {
2214
+ startLayoutEffectTimer ( ) ;
2200
2215
inst . destroy = undefined ;
2201
2216
safelyCallDestroy (
2202
2217
deletedFiber ,
2203
2218
nearestMountedAncestor ,
2204
2219
destroy ,
2205
2220
) ;
2206
- } else if ( ( tag & HookLayout ) !== NoHookEffect ) {
2207
- if ( enableSchedulingProfiler ) {
2208
- markComponentLayoutEffectUnmountStarted ( deletedFiber ) ;
2209
- }
2210
-
2211
- if ( shouldProfile ( deletedFiber ) ) {
2212
- startLayoutEffectTimer ( ) ;
2213
- inst . destroy = undefined ;
2214
- safelyCallDestroy (
2215
- deletedFiber ,
2216
- nearestMountedAncestor ,
2217
- destroy ,
2218
- ) ;
2219
- recordLayoutEffectDuration ( deletedFiber ) ;
2220
- } else {
2221
- inst . destroy = undefined ;
2222
- safelyCallDestroy (
2223
- deletedFiber ,
2224
- nearestMountedAncestor ,
2225
- destroy ,
2226
- ) ;
2227
- }
2221
+ recordLayoutEffectDuration ( deletedFiber ) ;
2222
+ } else {
2223
+ inst . destroy = undefined ;
2224
+ safelyCallDestroy (
2225
+ deletedFiber ,
2226
+ nearestMountedAncestor ,
2227
+ destroy ,
2228
+ ) ;
2229
+ }
2228
2230
2229
- if ( enableSchedulingProfiler ) {
2230
- markComponentLayoutEffectUnmountStopped ( ) ;
2231
- }
2231
+ if ( enableSchedulingProfiler ) {
2232
+ markComponentLayoutEffectUnmountStopped ( ) ;
2232
2233
}
2233
2234
}
2234
- effect = effect . next ;
2235
- } while ( effect !== firstEffect ) ;
2236
- }
2235
+ }
2236
+ effect = effect . next ;
2237
+ } while ( effect !== firstEffect ) ;
2237
2238
}
2238
2239
}
2239
2240
0 commit comments