Skip to content

Commit d10b52b

Browse files
committed
Make unmounting unfiltered Suspense node an invariant
1 parent 4c27100 commit d10b52b

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
@@ -2519,7 +2519,6 @@ export function attach(
25192519
}
25202520
}
25212521
2522-
// TODO:
25232522
function recordSuspenseUnmount(suspenseInstance: SuspenseNode): void {
25242523
if (__DEBUG__) {
25252524
console.log(
@@ -2529,9 +2528,12 @@ export function attach(
25292528
);
25302529
}
25312530
2532-
// TODO: We're not unmounting filtered instances anyway. Think about if we
2533-
// can just use recordUnmount() for this as well.
2534-
const id = ((suspenseInstance.instance: any): FiberInstance).id;
2531+
const devtoolsInstance = suspenseInstance.instance;
2532+
if (devtoolsInstance.kind !== FIBER_INSTANCE) {
2533+
throw new Error("Can't unmount a filtered SuspenseNode. This is a bug.");
2534+
}
2535+
const fiberInstance = devtoolsInstance;
2536+
const id = fiberInstance.id;
25352537
25362538
// To maintain child-first ordering,
25372539
// we'll push it into one of these queues,

0 commit comments

Comments
 (0)