Skip to content

Commit

Permalink
fix: consider alternate as a key for componentLogsEntry when inspecti…
Browse files Browse the repository at this point in the history
…ng raw fiber instance
  • Loading branch information
hoxyq committed Sep 20, 2024
1 parent e495392 commit a5b2ad4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a5b2ad4

Please sign in to comment.