Skip to content

Commit 1496d14

Browse files
committed
Use debugLocation in DevTools if we have it already
1 parent 85450a8 commit 1496d14

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • packages/react-devtools-shared/src/backend/fiber

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5831,13 +5831,21 @@ export function attach(
58315831
}
58325832

58335833
function getSourceForInstance(instance: DevToolsInstance): Source | null {
5834-
const unresolvedSource = instance.source;
5834+
let unresolvedSource = instance.source;
58355835
if (unresolvedSource === null) {
58365836
// We don't have any source yet. We can try again later in case an owned child mounts later.
58375837
// TODO: We won't have any information here if the child is filtered.
58385838
return null;
58395839
}
58405840

5841+
if (instance.kind === VIRTUAL_INSTANCE) {
5842+
// We might have found one on the virtual instance.
5843+
const debugLocation = instance.data.debugLocation;
5844+
if (debugLocation != null) {
5845+
unresolvedSource = debugLocation;
5846+
}
5847+
}
5848+
58415849
// If we have the debug stack (the creation stack of the JSX) for any owned child of this
58425850
// component, then at the bottom of that stack will be a stack frame that is somewhere within
58435851
// the component's function body. Typically it would be the callsite of the JSX unless there's

0 commit comments

Comments
 (0)