Skip to content

Commit 0417546

Browse files
authored
[DevTools] Only show state for ClassComponents (#34091)
The only thing that uses `memoizedState` as a public API is ClassComponents. Everything else uses it as internals. We shouldn't ever show those internals. Before those internals showed up for example on a suspended Suspense boundary: <img width="436" height="370" alt="Screenshot 2025-08-03 at 8 13 37 PM" src="https://github.com/user-attachments/assets/7fe275a7-d5da-421d-a000-523825916630" />
1 parent 30fca45 commit 0417546

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ export function attach(
969969
} = getInternalReactConstants(version);
970970
const {
971971
ActivityComponent,
972-
CacheComponent,
973972
ClassComponent,
974973
ContextConsumer,
975974
DehydratedSuspenseComponent,
@@ -4618,7 +4617,8 @@ export function attach(
46184617
46194618
// TODO Show custom UI for Cache like we do for Suspense
46204619
// For now, just hide state data entirely since it's not meant to be inspected.
4621-
const showState = !usesHooks && tag !== CacheComponent;
4620+
const showState =
4621+
tag === ClassComponent || tag === IncompleteClassComponent;
46224622
46234623
const typeSymbol = getTypeSymbol(type);
46244624

0 commit comments

Comments
 (0)