Skip to content

Commit b46b86b

Browse files
committed
Fix locator on click logic
1 parent 093b065 commit b46b86b

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

packages/debugger/src/locator/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,13 @@ export function createLocator<TEl extends object>(props: {
164164
return
165165
}
166166

167-
if (comp.location == null) {
168-
DEV: {warn("Locator: can't find source location for component (comp=%o)", comp)}
169-
return
170-
}
171-
172-
let source_code_data = locator.getSourceCodeData(comp.location, comp.element as any)
173-
if (source_code_data == null) {
174-
DEV: {warn("Locator: can't find source code data for component (comp=%o)", comp)}
175-
return
176-
}
167+
let source_code_data = comp.location
168+
? locator.getSourceCodeData(comp.location, comp.element as any)
169+
: null
177170

178171
// intercept on-page components clicks and send them to the devtools overlay
179172
props.onComponentClick(comp.id, () => {
180-
if (target_ide == null) return
173+
if (target_ide == null || source_code_data == null) return
181174
e.preventDefault()
182175
e.stopPropagation()
183176
locator.openSourceCode(target_ide, source_code_data)

0 commit comments

Comments
 (0)