@@ -829,12 +829,6 @@ export function attach(
829
829
throw Error ( 'Cannot modify filter preferences while profiling' ) ;
830
830
}
831
831
832
- unmountAndRemountAllRoots(() => {
833
- applyComponentFilters ( componentFilters ) ;
834
- } );
835
- }
836
-
837
- function unmountAndRemountAllRoots ( callback ?: Function ) {
838
832
// Recursively unmount all roots.
839
833
hook.getFiberRoots(rendererID).forEach(root => {
840
834
currentRootID = getOrGenerateFiberID ( root . current ) ;
@@ -846,9 +840,7 @@ export function attach(
846
840
currentRootID = - 1 ;
847
841
} );
848
842
849
- if ( typeof callback === 'function' ) {
850
- callback ( ) ;
851
- }
843
+ applyComponentFilters(componentFilters);
852
844
853
845
// Reset pseudo counters so that new path selections will be persisted.
854
846
rootDisplayNameCounter.clear();
@@ -1797,20 +1789,6 @@ export function attach(
1797
1789
) ;
1798
1790
}
1799
1791
1800
- const unsafeID = getFiberIDUnsafe ( fiber ) ;
1801
- if ( fiber . _debugNeedsRemount ) {
1802
- if ( unsafeID === null ) {
1803
- // This inidicates a case we can't recover from:
1804
- // Fast Refresh has force remounted a component in a way that we don't have an id for.
1805
- // We could throw but that's a bad user experience.
1806
- // Or we could ignore the unmount but then Store might end up with a duplicate node.
1807
- // So a fallback is to completely reset the Store.
1808
- // This is costly but since Fast Refresh is only used in DEV builds, it should be okay.
1809
- setTimeout ( unmountAndRemountAllRoots , 0 ) ;
1810
- return ;
1811
- }
1812
- }
1813
-
1814
1792
if ( trackedPathMatchFiber !== null ) {
1815
1793
// We're in the process of trying to restore previous selection.
1816
1794
// If this fiber matched but is being unmounted, there's no use trying.
@@ -1823,11 +1801,14 @@ export function attach(
1823
1801
}
1824
1802
}
1825
1803
1804
+ const unsafeID = getFiberIDUnsafe ( fiber ) ;
1826
1805
if ( unsafeID === null ) {
1827
1806
// 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).
1828
1807
// In that case we can just ignore it or it will cause errors later on.
1829
1808
// One example of this is a Lazy component that never resolves before being unmounted.
1830
1809
//
1810
+ // This also might indicate a Fast Refresh force-remount scenario.
1811
+ //
1831
1812
// TODO: This is fragile and can obscure actual bugs.
1832
1813
return ;
1833
1814
}
0 commit comments