diff --git a/src/backend/renderer.js b/src/backend/renderer.js index 93422455e4..ad099cf6df 100644 --- a/src/backend/renderer.js +++ b/src/backend/renderer.js @@ -1925,7 +1925,7 @@ export function attach( owners, // Location of component in source coude. - source: _debugSource, + source: _debugSource || null, }; } @@ -1986,6 +1986,9 @@ export function attach( if (nativeNodes !== null) { console.log('Nodes:', nativeNodes); } + if (result.source !== null) { + console.log('Location:', result.source); + } if (window.chrome || /firefox/i.test(navigator.userAgent)) { console.log( 'Right-click any value to save it as a global variable for further inspection.' diff --git a/src/backend/types.js b/src/backend/types.js index c9f8db6522..bce7238efd 100644 --- a/src/backend/types.js +++ b/src/backend/types.js @@ -191,7 +191,7 @@ export type InspectedElement = {| owners: Array | null, // Location of component in source coude. - source: Object | null, + source: Source | null, type: ElementType, |}; diff --git a/src/devtools/views/Components/types.js b/src/devtools/views/Components/types.js index 31c5c6c793..106b184ac5 100644 --- a/src/devtools/views/Components/types.js +++ b/src/devtools/views/Components/types.js @@ -44,6 +44,11 @@ export type OwnersList = {| owners: Array | null, |}; +export type Source = {| + fileName: string, + lineNumber: number, +|}; + export type InspectedElement = {| id: number, @@ -72,7 +77,7 @@ export type InspectedElement = {| owners: Array | null, // Location of component in source coude. - source: Object | null, + source: Source | null, type: ElementType, |};