Skip to content

Commit cabf398

Browse files
committed
use location.origin; make console links origin-aware
Replace localhost/token URL in open-in-editor
1 parent 2509c7f commit cabf398

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

‎packages/devtools-vite/src/plugin.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,6 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
119119
}),
120120
)
121121
},
122-
transform(code) {
123-
if (code.includes('__TSD_PORT__')) {
124-
code = code.replace('__TSD_PORT__', String(port))
125-
}
126-
if (code.includes('__TSD_HOST__')) {
127-
code = code.replace('__TSD_HOST__', host)
128-
}
129-
return code
130-
},
131122
},
132123
{
133124
name: '@tanstack/devtools:better-console-logs',

‎packages/devtools/src/devtools.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ export default function DevTools() {
174174
e.preventDefault()
175175
e.stopPropagation()
176176
fetch(
177-
`__TSD_HOST__://localhost:__TSD_PORT__/__tsd/open-source?source=${encodeURIComponent(dataSource)}`,
177+
`${location.origin}/__tsd/open-source?source=${encodeURIComponent(
178+
dataSource,
179+
)}`,
178180
).catch(() => {})
179181
}
180182
}

0 commit comments

Comments
 (0)