Skip to content

Commit 80d0cdb

Browse files
author
Brian Vaughn
committed
DevTools: Fix another Fast Refresh edge case
Don't untrack unmounted Fibers after logging errors/warnings because it sometimes causes prematurely untracking a force-remounted Fiber from Fast Refresh, which in turn causes DevTools to break when the component is later inspected. This is a hack but I'm not sure of a better workaround.
1 parent ebcec3c commit 80d0cdb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,10 @@ export function attach(
15161516
// We may also need to clean up after ourselves to avoid leaks.
15171517
// See inline comments in onErrorOrWarning() for more info.
15181518
if (isFiberMountedImpl(fiber) !== MOUNTED) {
1519-
untrackFiberID(fiber);
1519+
// HACK Cleaning up "unmounted" Fibers here can cause problems with Fast Refresh.
1520+
// Since warnings and errors are generally used in DEV mode,
1521+
// it may be better to ignore this kind of potential leak case rather than break Fast Refresh.
1522+
// untrackFiberID(fiber);
15201523
return;
15211524
}
15221525

0 commit comments

Comments
 (0)