Skip to content

Commit 2fe02f9

Browse files
fix issue with window not defined (#103)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 6c7fb1a commit 2fe02f9

File tree

10 files changed

+34
-8
lines changed

10 files changed

+34
-8
lines changed

.changeset/ripe-ravens-read.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+
add peer dep to devtools

.changeset/thin-singers-retire.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+
fix issue with window not defined

examples/react/basic/src/setup.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export default function DevtoolsExample() {
7272
name: 'TanStack Router',
7373
render: <TanStackRouterDevtoolsPanel router={router} />,
7474
},
75+
/* {
76+
name: "The actual app",
77+
render: <iframe style={{ width: '100%', height: '100%' }} src="http://localhost:3005" />,
78+
} */
7579
]}
7680
/>
7781
<RouterProvider router={router} />

examples/react/drizzle/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"drizzle-orm": "^0.44.4",
2525
"pg": "^8.16.3",
2626
"typescript": "5.8.3",
27-
"vite": "^7.0.6"
27+
"vite": "^7.0.6",
28+
"vite-plugin-inspect": "11.3.2"
2829
}
2930
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
22
import { defineConfig } from 'vite'
33
import { devtools } from '@tanstack/devtools-vite'
4+
import Inspect from 'vite-plugin-inspect'
45

56
export default defineConfig({
67
server: {
78
port: 3000,
89
},
9-
plugins: [devtools() as any, tanstackStart()],
10+
plugins: [devtools() as any, tanstackStart(), Inspect()],
1011
})

examples/react/start/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"start": "node .output/server/index.mjs",
88
"serve": "vite preview",
99
"test": "vitest run",
10-
"preview": "vite preview",
10+
"preview": "vite build && vite preview",
1111
"db:migrate": "prisma migrate dev --name init",
1212
"db:reset": " prisma migrate reset",
1313
"db:gen": "prisma generate",
@@ -45,6 +45,7 @@
4545
"jsdom": "^26.1.0",
4646
"typescript": "5.8.3",
4747
"vite": "^7.0.6",
48+
"vite-plugin-inspect": "11.3.2",
4849
"vitest": "^3.1.2",
4950
"web-vitals": "^4.2.4"
5051
}

examples/react/start/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import viteReact from '@vitejs/plugin-react'
44
import viteTsConfigPaths from 'vite-tsconfig-paths'
55
import tailwindcss from '@tailwindcss/vite'
66
import { devtools } from '@tanstack/devtools-vite'
7-
//import { devtoolsServer } from './src/server-setup'
7+
import Inspect from 'vite-plugin-inspect'
88

99
const config = defineConfig({
1010
plugins: [
@@ -20,7 +20,7 @@ const config = defineConfig({
2020
viteTsConfigPaths({
2121
projects: ['./tsconfig.json'],
2222
}),
23-
23+
Inspect(),
2424
tailwindcss(),
2525
tanstackStart({
2626
customViteReactPlugin: true,

packages/devtools/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"solid-js": "^1.9.7"
5757
},
5858
"peerDependencies": {
59+
"@tanstack/devtools-ui": "workspace:*",
5960
"solid-js": ">=1.9.7"
6061
},
6162
"devDependencies": {

packages/devtools/src/context/devtools-store.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ export const initialState: DevtoolsStore = {
8080
openHotkey: ['Shift', 'A'],
8181
requireUrlFlag: false,
8282
urlFlag: 'tanstack-devtools',
83-
theme: window.matchMedia('(prefers-color-scheme: dark)').matches
84-
? 'dark'
85-
: 'light',
83+
theme:
84+
typeof window !== 'undefined' &&
85+
window.matchMedia('(prefers-color-scheme: dark)').matches
86+
? 'dark'
87+
: 'light',
8688
},
8789
state: {
8890
activeTab: 'plugins',

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)