[DevTools] Fix React Compiler badging (#31196)
In #31140 we switched over the uMC polyfill to use memo instead of state since memo would FastRefresh properly. However this busted devtools' badging of compiled components; this PR fixes it. TODO: tests Co-authored-by: Ruslan Lesiutin <rdlesyutin@gmail.com> --------- Co-authored-by: Ruslan Lesiutin <rdlesyutin@gmail.com>
lauren committed
Oct 15, 2024 at 07:53 UTC
9806a4b0d4e659863f3f04d32da50f545c7199a8
1 file changed
+2
packages/react-devtools-shared/src/backend/fiber/renderer.js
+2
@@ -599,6 +599,8 @@ export function getInternalReactConstants(version: string): {
599
!shouldSkipForgetCheck &&
600
// $FlowFixMe[incompatible-type] fiber.updateQueue is mixed
601
(fiber.updateQueue?.memoCache != null ||
602
+ (Array.isArray(fiber.memoizedState?.memoizedState) &&
603
+ fiber.memoizedState.memoizedState[0]?.[REACT_MEMO_CACHE_SENTINEL]) ||
604
fiber.memoizedState?.memoizedState?.[REACT_MEMO_CACHE_SENTINEL])
605
) {
606
const displayNameWithoutForgetWrapper = getDisplayNameForFiber(