Skip to content

Commit 6aff312

Browse files
committed
Make unmounting unfiltered Suspense node an invariant
1 parent b3a2b0b commit 6aff312

File tree

1 file changed

+6
-4
lines changed
  • packages/react-devtools-shared/src/backend/fiber

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,7 +2479,6 @@ export function attach(
24792479
untrackFiber(fiberInstance, fiber);
24802480
}
24812481
2482-
// TODO:
24832482
function recordSuspenseUnmount(suspenseInstance: SuspenseNode): void {
24842483
if (__DEBUG__) {
24852484
console.log(
@@ -2489,9 +2488,12 @@ export function attach(
24892488
);
24902489
}
24912490
2492-
// TODO: We're not unmounting filtered instances anyway. Think about if we
2493-
// can just use recordUnmount() for this as well.
2494-
const id = ((suspenseInstance.instance: any): FiberInstance).id;
2491+
const devtoolsInstance = suspenseInstance.instance;
2492+
if (devtoolsInstance.kind !== FIBER_INSTANCE) {
2493+
throw new Error("Can't unmount a filtered SuspenseNode. This is a bug.");
2494+
}
2495+
const fiberInstance = devtoolsInstance;
2496+
const id = fiberInstance.id;
24952497
24962498
// To maintain child-first ordering,
24972499
// we'll push it into one of these queues,

0 commit comments

Comments
 (0)