Skip to content

Commit e1daa05

Browse files
chore(examples): fix with-trpc and with-trpc-react-query examples (#4539)
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
1 parent 5d50a30 commit e1daa05

File tree

18 files changed

+2494
-2685
lines changed

18 files changed

+2494
-2685
lines changed

examples/react/with-trpc-react-query/app.config.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/react/with-trpc-react-query/package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,36 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"dev": "vite dev",
7-
"build": "vite build && tsc --noEmit",
8-
"start": "vite start"
6+
"dev": "pnpm tsx ./src/server/server.ts --watch",
7+
"build": "pnpm run build:server && pnpm run build:client",
8+
"build:client": "vite build && tsc --noEmit",
9+
"build:server": "vite build --mode server",
10+
"start": "NODE_ENV=production node dist/server/server.js"
911
},
1012
"dependencies": {
1113
"@tanstack/react-query": "^5.66.0",
1214
"@tanstack/react-query-devtools": "^5.66.0",
1315
"@tanstack/react-router": "^1.123.0",
1416
"@tanstack/react-router-devtools": "^1.123.0",
1517
"@tanstack/router-plugin": "^1.123.0",
16-
"@tanstack/react-start": "^1.123.0",
17-
"@trpc/client": "11.0.0-rc.772",
18-
"@trpc/server": "11.0.0-rc.772",
19-
"@trpc/tanstack-react-query": "11.0.0-rc.772",
20-
"react": "^19.0.0",
21-
"react-dom": "^19.0.0",
22-
"redaxios": "^0.5.1",
23-
"postcss": "^8.5.1",
18+
"@trpc/client": "^11.4.3",
19+
"@trpc/server": "^11.4.3",
20+
"@trpc/tanstack-react-query": "^11.4.3",
2421
"autoprefixer": "^10.4.20",
22+
"express": "^4.21.2",
23+
"postcss": "^8.5.1",
24+
"react": "^19.1.0",
25+
"react-dom": "^19.1.0",
26+
"redaxios": "^0.5.1",
2527
"tailwindcss": "^3.4.17",
2628
"zod": "^3.24.2"
2729
},
2830
"devDependencies": {
31+
"@types/express": "^4.17.23",
2932
"@types/react": "^19.0.8",
3033
"@types/react-dom": "^19.0.3",
31-
"@vitejs/plugin-react": "^4.3.4"
34+
"@vitejs/plugin-react": "^4.3.4",
35+
"tsx": "^4.20.3",
36+
"vite": "^6.3.5"
3237
}
3338
}

examples/react/with-trpc-react-query/src/routeTree.gen.ts

Lines changed: 89 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -8,105 +8,141 @@
88
// You should NOT make any changes in this file as it will be overwritten.
99
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
1010

11-
// Import Routes
12-
13-
import { Route as rootRoute } from './routes/__root'
14-
import { Route as DashboardImport } from './routes/dashboard'
15-
import { Route as IndexImport } from './routes/index'
16-
import { Route as DashboardIndexImport } from './routes/dashboard.index'
17-
import { Route as DashboardPostsImport } from './routes/dashboard.posts'
18-
import { Route as DashboardPostsIndexImport } from './routes/dashboard.posts.index'
19-
import { Route as DashboardPostsPostIdImport } from './routes/dashboard.posts.$postId'
20-
21-
// Create/Update Routes
22-
23-
const DashboardRoute = DashboardImport.update({
11+
import { Route as rootRouteImport } from './routes/__root'
12+
import { Route as DashboardRouteImport } from './routes/dashboard'
13+
import { Route as IndexRouteImport } from './routes/index'
14+
import { Route as DashboardIndexRouteImport } from './routes/dashboard.index'
15+
import { Route as DashboardPostsRouteImport } from './routes/dashboard.posts'
16+
import { Route as DashboardPostsIndexRouteImport } from './routes/dashboard.posts.index'
17+
import { Route as DashboardPostsPostIdRouteImport } from './routes/dashboard.posts.$postId'
18+
19+
const DashboardRoute = DashboardRouteImport.update({
2420
id: '/dashboard',
2521
path: '/dashboard',
26-
getParentRoute: () => rootRoute,
22+
getParentRoute: () => rootRouteImport,
2723
} as any)
28-
29-
const IndexRoute = IndexImport.update({
24+
const IndexRoute = IndexRouteImport.update({
3025
id: '/',
3126
path: '/',
32-
getParentRoute: () => rootRoute,
27+
getParentRoute: () => rootRouteImport,
3328
} as any)
34-
35-
const DashboardIndexRoute = DashboardIndexImport.update({
29+
const DashboardIndexRoute = DashboardIndexRouteImport.update({
3630
id: '/',
3731
path: '/',
3832
getParentRoute: () => DashboardRoute,
3933
} as any)
40-
41-
const DashboardPostsRoute = DashboardPostsImport.update({
34+
const DashboardPostsRoute = DashboardPostsRouteImport.update({
4235
id: '/posts',
4336
path: '/posts',
4437
getParentRoute: () => DashboardRoute,
4538
} as any)
46-
47-
const DashboardPostsIndexRoute = DashboardPostsIndexImport.update({
39+
const DashboardPostsIndexRoute = DashboardPostsIndexRouteImport.update({
4840
id: '/',
4941
path: '/',
5042
getParentRoute: () => DashboardPostsRoute,
5143
} as any)
52-
53-
const DashboardPostsPostIdRoute = DashboardPostsPostIdImport.update({
44+
const DashboardPostsPostIdRoute = DashboardPostsPostIdRouteImport.update({
5445
id: '/$postId',
5546
path: '/$postId',
5647
getParentRoute: () => DashboardPostsRoute,
5748
} as any)
5849

59-
// Populate the FileRoutesByPath interface
50+
export interface FileRoutesByFullPath {
51+
'/': typeof IndexRoute
52+
'/dashboard': typeof DashboardRouteWithChildren
53+
'/dashboard/posts': typeof DashboardPostsRouteWithChildren
54+
'/dashboard/': typeof DashboardIndexRoute
55+
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
56+
'/dashboard/posts/': typeof DashboardPostsIndexRoute
57+
}
58+
export interface FileRoutesByTo {
59+
'/': typeof IndexRoute
60+
'/dashboard': typeof DashboardIndexRoute
61+
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
62+
'/dashboard/posts': typeof DashboardPostsIndexRoute
63+
}
64+
export interface FileRoutesById {
65+
__root__: typeof rootRouteImport
66+
'/': typeof IndexRoute
67+
'/dashboard': typeof DashboardRouteWithChildren
68+
'/dashboard/posts': typeof DashboardPostsRouteWithChildren
69+
'/dashboard/': typeof DashboardIndexRoute
70+
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
71+
'/dashboard/posts/': typeof DashboardPostsIndexRoute
72+
}
73+
export interface FileRouteTypes {
74+
fileRoutesByFullPath: FileRoutesByFullPath
75+
fullPaths:
76+
| '/'
77+
| '/dashboard'
78+
| '/dashboard/posts'
79+
| '/dashboard/'
80+
| '/dashboard/posts/$postId'
81+
| '/dashboard/posts/'
82+
fileRoutesByTo: FileRoutesByTo
83+
to: '/' | '/dashboard' | '/dashboard/posts/$postId' | '/dashboard/posts'
84+
id:
85+
| '__root__'
86+
| '/'
87+
| '/dashboard'
88+
| '/dashboard/posts'
89+
| '/dashboard/'
90+
| '/dashboard/posts/$postId'
91+
| '/dashboard/posts/'
92+
fileRoutesById: FileRoutesById
93+
}
94+
export interface RootRouteChildren {
95+
IndexRoute: typeof IndexRoute
96+
DashboardRoute: typeof DashboardRouteWithChildren
97+
}
6098

6199
declare module '@tanstack/react-router' {
62100
interface FileRoutesByPath {
101+
'/dashboard': {
102+
id: '/dashboard'
103+
path: '/dashboard'
104+
fullPath: '/dashboard'
105+
preLoaderRoute: typeof DashboardRouteImport
106+
parentRoute: typeof rootRouteImport
107+
}
63108
'/': {
64109
id: '/'
65110
path: '/'
66111
fullPath: '/'
67-
preLoaderRoute: typeof IndexImport
68-
parentRoute: typeof rootRoute
112+
preLoaderRoute: typeof IndexRouteImport
113+
parentRoute: typeof rootRouteImport
69114
}
70-
'/dashboard': {
71-
id: '/dashboard'
72-
path: '/dashboard'
73-
fullPath: '/dashboard'
74-
preLoaderRoute: typeof DashboardImport
75-
parentRoute: typeof rootRoute
115+
'/dashboard/': {
116+
id: '/dashboard/'
117+
path: '/'
118+
fullPath: '/dashboard/'
119+
preLoaderRoute: typeof DashboardIndexRouteImport
120+
parentRoute: typeof DashboardRoute
76121
}
77122
'/dashboard/posts': {
78123
id: '/dashboard/posts'
79124
path: '/posts'
80125
fullPath: '/dashboard/posts'
81-
preLoaderRoute: typeof DashboardPostsImport
82-
parentRoute: typeof DashboardImport
126+
preLoaderRoute: typeof DashboardPostsRouteImport
127+
parentRoute: typeof DashboardRoute
83128
}
84-
'/dashboard/': {
85-
id: '/dashboard/'
129+
'/dashboard/posts/': {
130+
id: '/dashboard/posts/'
86131
path: '/'
87-
fullPath: '/dashboard/'
88-
preLoaderRoute: typeof DashboardIndexImport
89-
parentRoute: typeof DashboardImport
132+
fullPath: '/dashboard/posts/'
133+
preLoaderRoute: typeof DashboardPostsIndexRouteImport
134+
parentRoute: typeof DashboardPostsRoute
90135
}
91136
'/dashboard/posts/$postId': {
92137
id: '/dashboard/posts/$postId'
93138
path: '/$postId'
94139
fullPath: '/dashboard/posts/$postId'
95-
preLoaderRoute: typeof DashboardPostsPostIdImport
96-
parentRoute: typeof DashboardPostsImport
97-
}
98-
'/dashboard/posts/': {
99-
id: '/dashboard/posts/'
100-
path: '/'
101-
fullPath: '/dashboard/posts/'
102-
preLoaderRoute: typeof DashboardPostsIndexImport
103-
parentRoute: typeof DashboardPostsImport
140+
preLoaderRoute: typeof DashboardPostsPostIdRouteImport
141+
parentRoute: typeof DashboardPostsRoute
104142
}
105143
}
106144
}
107145

108-
// Create and export the route tree
109-
110146
interface DashboardPostsRouteChildren {
111147
DashboardPostsPostIdRoute: typeof DashboardPostsPostIdRoute
112148
DashboardPostsIndexRoute: typeof DashboardPostsIndexRoute
@@ -135,108 +171,10 @@ const DashboardRouteWithChildren = DashboardRoute._addFileChildren(
135171
DashboardRouteChildren,
136172
)
137173

138-
export interface FileRoutesByFullPath {
139-
'/': typeof IndexRoute
140-
'/dashboard': typeof DashboardRouteWithChildren
141-
'/dashboard/posts': typeof DashboardPostsRouteWithChildren
142-
'/dashboard/': typeof DashboardIndexRoute
143-
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
144-
'/dashboard/posts/': typeof DashboardPostsIndexRoute
145-
}
146-
147-
export interface FileRoutesByTo {
148-
'/': typeof IndexRoute
149-
'/dashboard': typeof DashboardIndexRoute
150-
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
151-
'/dashboard/posts': typeof DashboardPostsIndexRoute
152-
}
153-
154-
export interface FileRoutesById {
155-
__root__: typeof rootRoute
156-
'/': typeof IndexRoute
157-
'/dashboard': typeof DashboardRouteWithChildren
158-
'/dashboard/posts': typeof DashboardPostsRouteWithChildren
159-
'/dashboard/': typeof DashboardIndexRoute
160-
'/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute
161-
'/dashboard/posts/': typeof DashboardPostsIndexRoute
162-
}
163-
164-
export interface FileRouteTypes {
165-
fileRoutesByFullPath: FileRoutesByFullPath
166-
fullPaths:
167-
| '/'
168-
| '/dashboard'
169-
| '/dashboard/posts'
170-
| '/dashboard/'
171-
| '/dashboard/posts/$postId'
172-
| '/dashboard/posts/'
173-
fileRoutesByTo: FileRoutesByTo
174-
to: '/' | '/dashboard' | '/dashboard/posts/$postId' | '/dashboard/posts'
175-
id:
176-
| '__root__'
177-
| '/'
178-
| '/dashboard'
179-
| '/dashboard/posts'
180-
| '/dashboard/'
181-
| '/dashboard/posts/$postId'
182-
| '/dashboard/posts/'
183-
fileRoutesById: FileRoutesById
184-
}
185-
186-
export interface RootRouteChildren {
187-
IndexRoute: typeof IndexRoute
188-
DashboardRoute: typeof DashboardRouteWithChildren
189-
}
190-
191174
const rootRouteChildren: RootRouteChildren = {
192175
IndexRoute: IndexRoute,
193176
DashboardRoute: DashboardRouteWithChildren,
194177
}
195-
196-
export const routeTree = rootRoute
178+
export const routeTree = rootRouteImport
197179
._addFileChildren(rootRouteChildren)
198180
._addFileTypes<FileRouteTypes>()
199-
200-
/* ROUTE_MANIFEST_START
201-
{
202-
"routes": {
203-
"__root__": {
204-
"filePath": "__root.tsx",
205-
"children": [
206-
"/",
207-
"/dashboard"
208-
]
209-
},
210-
"/": {
211-
"filePath": "index.tsx"
212-
},
213-
"/dashboard": {
214-
"filePath": "dashboard.tsx",
215-
"children": [
216-
"/dashboard/posts",
217-
"/dashboard/"
218-
]
219-
},
220-
"/dashboard/posts": {
221-
"filePath": "dashboard.posts.tsx",
222-
"parent": "/dashboard",
223-
"children": [
224-
"/dashboard/posts/$postId",
225-
"/dashboard/posts/"
226-
]
227-
},
228-
"/dashboard/": {
229-
"filePath": "dashboard.index.tsx",
230-
"parent": "/dashboard"
231-
},
232-
"/dashboard/posts/$postId": {
233-
"filePath": "dashboard.posts.$postId.tsx",
234-
"parent": "/dashboard/posts"
235-
},
236-
"/dashboard/posts/": {
237-
"filePath": "dashboard.posts.index.tsx",
238-
"parent": "/dashboard/posts"
239-
}
240-
}
241-
}
242-
ROUTE_MANIFEST_END */

0 commit comments

Comments
 (0)