From 9fea8bffb93d51e7e043d5793ec98ae1bc8b13f3 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 6 May 2022 15:02:56 -0400 Subject: [PATCH] fix double unmounting fibers --- packages/react-devtools-shared/src/backend/renderer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 5e09a2d0f8043..055b57ee4b52e 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -2630,6 +2630,10 @@ export function attach( } function handleCommitFiberUnmount(fiber) { + // Flush any pending Fibers that we are untracking before processing the new commit. + // If we don't do this, we might end up double-deleting Fibers in some cases (like Legacy Suspense). + untrackFibers(); + // This is not recursive. // We can't traverse fibers after unmounting so instead // we rely on React telling us about each unmount.