Skip to content

Commit 096744e

Browse files
fix: fix SourceInspector works behind proxy on subpath (#249)
* fix: fix SourceInspector works behind proxy on subpath * changeset * fix changeset to patch * ensure changes work in none vite env --------- Co-authored-by: Alem Tuzlak <[email protected]>
1 parent 4d3c497 commit 096744e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/neat-spies-spend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools': patch
3+
---
4+
5+
fixed an issue where SourceInspector was not working when the app is served to a subpath

packages/devtools/src/components/source-inspector.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ export const SourceInspector = () => {
7878
e.preventDefault()
7979
e.stopPropagation()
8080

81-
fetch(
82-
`${location.origin}/__tsd/open-source?source=${encodeURIComponent(
81+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
82+
const baseUrl = new URL(import.meta.env?.BASE_URL ?? '/', location.origin)
83+
const url = new URL(
84+
`__tsd/open-source?source=${encodeURIComponent(
8385
highlightState.dataSource,
8486
)}`,
85-
).catch(() => {})
87+
baseUrl,
88+
)
89+
fetch(url).catch(() => {})
8690
})
8791

8892
const currentElementBoxStyles = createMemo(() => {

0 commit comments

Comments
 (0)