Skip to content

Commit 370c545

Browse files
committed
Remove element field from SourceCodeData
1 parent 9e1fa49 commit 370c545

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

.changeset/light-friends-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solid-devtools/debugger": minor
3+
---
4+
5+
Remove element field from SourceCodeData

packages/debugger/src/locator/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function createLocator<TEl extends object>(props: {
165165
}
166166

167167
let source_code_data = comp.location
168-
? locator.getSourceCodeData(comp.location, comp.element as any)
168+
? locator.getSourceCodeData(comp.location)
169169
: null
170170

171171
// intercept on-page components clicks and send them to the devtools overlay
@@ -210,14 +210,13 @@ export function createLocator<TEl extends object>(props: {
210210
setDevtoolsHighlightTarget(target: locator.HighlightElementPayload) {
211211
setDevtoolsTarget(target)
212212
},
213-
openElementSourceCode(location: SourceLocation, element: locator.SourceCodeData['element']) {
213+
openElementSourceCode(location: SourceLocation) {
214214
if (!target_ide) return warn('Please set `targetIDE` it in useLocator options.')
215215
const projectPath = locator.getProjectPath()
216216
if (!projectPath) return warn('projectPath is not set.')
217217
locator.openSourceCode(target_ide, {
218218
...location,
219219
projectPath,
220-
element,
221220
})
222221
},
223222
}

packages/debugger/src/locator/locator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export type TargetIDE = 'vscode' | 'webstorm' | 'atom' | 'vscode-insiders'
2828

2929
export type SourceCodeData = SourceLocation & {
3030
projectPath: string
31-
element: HTMLElement | string | undefined
3231
}
3332

3433
export type TargetURLFunction = (data: SourceCodeData) => string | void
@@ -65,13 +64,12 @@ export const getProjectPath = (): string | undefined => (window as any)[WINDOW_P
6564

6665
export function getSourceCodeData(
6766
location: SourceLocation,
68-
element: SourceCodeData['element'],
6967
): SourceCodeData | undefined {
7068

7169
let projectPath: string | undefined = getProjectPath()
7270
if (projectPath == null) return
7371

74-
return {...location, projectPath, element}
72+
return {...location, projectPath}
7573
}
7674

7775
/**

packages/debugger/src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function createDebugger<TEl extends object>(
208208
// Opens the source code of the inspected component
209209
function openInspectedNodeLocation() {
210210
const details = inspector.getLastDetails()
211-
details?.location && locator.openElementSourceCode(details.location, details.name)
211+
details?.location && locator.openElementSourceCode(details.location)
212212
}
213213

214214
// send the state of the client locator mode

0 commit comments

Comments
 (0)