@@ -2184,7 +2184,8 @@ export function attach(
2184
2184
return fiberInstance ;
2185
2185
}
2186
2186
2187
- function recordUnmount ( fiber : Fiber ) : null | FiberInstance {
2187
+ function recordUnmount ( fiberInstance : FiberInstance ) : void {
2188
+ const fiber = fiberInstance . data ;
2188
2189
if ( __DEBUG__ ) {
2189
2190
debug ( 'recordUnmount()' , fiber , null ) ;
2190
2191
}
@@ -2201,18 +2202,6 @@ export function attach(
2201
2202
}
2202
2203
}
2203
2204
2204
- const fiberInstance = getFiberInstanceUnsafe ( fiber ) ;
2205
- if ( fiberInstance = = = null ) {
2206
- // If we've never seen this Fiber, it might be inside of a legacy render Suspense fragment (so the store is not even aware of it).
2207
- // In that case we can just ignore it or it will cause errors later on.
2208
- // One example of this is a Lazy component that never resolves before being unmounted.
2209
- //
2210
- // This also might indicate a Fast Refresh force-remount scenario.
2211
- //
2212
- // TODO: This is fragile and can obscure actual bugs.
2213
- return null ;
2214
- }
2215
-
2216
2205
const id = fiberInstance . id ;
2217
2206
const isRoot = fiber . tag = = = HostRoot ;
2218
2207
if ( isRoot ) {
@@ -2233,7 +2222,6 @@ export function attach(
2233
2222
idToRootMap . delete ( id ) ;
2234
2223
idToTreeBaseDurationMap . delete ( id ) ;
2235
2224
}
2236
- return fiberInstance ;
2237
2225
}
2238
2226
2239
2227
// Running state of the remaining children from the previous version of this parent that
@@ -2456,7 +2444,7 @@ export function attach(
2456
2444
remainingReconcilingChildren = stashedRemaining ;
2457
2445
}
2458
2446
if ( instance . kind = = = FIBER_INSTANCE ) {
2459
- recordUnmount ( instance . data ) ;
2447
+ recordUnmount ( instance ) ;
2460
2448
}
2461
2449
removeChild ( instance ) ;
2462
2450
}
0 commit comments