From a5b2ad49222c69a0abaaf282bea9ec268cd5f530 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Fri, 20 Sep 2024 12:06:09 +0100 Subject: [PATCH] fix: consider alternate as a key for componentLogsEntry when inspecting raw fiber instance --- .../react-devtools-shared/src/backend/fiber/renderer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-devtools-shared/src/backend/fiber/renderer.js b/packages/react-devtools-shared/src/backend/fiber/renderer.js index b8636c557ea25..d93e713911561 100644 --- a/packages/react-devtools-shared/src/backend/fiber/renderer.js +++ b/packages/react-devtools-shared/src/backend/fiber/renderer.js @@ -1029,6 +1029,10 @@ export function attach( if (devtoolsInstance.kind === FIBER_INSTANCE) { const fiber = devtoolsInstance.data; componentLogsEntry = fiberToComponentLogsMap.get(fiber); + + if (componentLogsEntry === undefined && fiber.alternate !== null) { + componentLogsEntry = fiberToComponentLogsMap.get(fiber.alternate); + } } else { const componentInfo = devtoolsInstance.data; componentLogsEntry = componentInfoToComponentLogsMap.get(componentInfo); @@ -4248,7 +4252,10 @@ export function attach( source = getSourceForFiberInstance(fiberInstance); } - const componentLogsEntry = fiberToComponentLogsMap.get(fiber); + let componentLogsEntry = fiberToComponentLogsMap.get(fiber); + if (componentLogsEntry === undefined && fiber.alternate !== null) { + componentLogsEntry = fiberToComponentLogsMap.get(fiber.alternate); + } return { id: fiberInstance.id,