Skip to content

Commit a852e3b

Browse files
committed
fix(playground): rewrite invalid session URLs
1 parent c3642db commit a852e3b

2 files changed

Lines changed: 49 additions & 2 deletions

File tree

apps/web/src/routeTree.gen.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@
1010

1111
import { Route as rootRouteImport } from './routes/__root'
1212
import { Route as ShadersRouteImport } from './routes/shaders'
13+
import { Route as PlaygroundRouteImport } from './routes/playground'
1314
import { Route as AboutRouteImport } from './routes/about'
1415
import { Route as IndexRouteImport } from './routes/index'
1516
import { Route as ShadersIndexRouteImport } from './routes/shaders.index'
1617
import { Route as ShadersNameRouteImport } from './routes/shaders.$name'
18+
import { Route as ApiPlaygroundSplatRouteImport } from './routes/api/playground/$'
1719
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
1820

1921
const ShadersRoute = ShadersRouteImport.update({
2022
id: '/shaders',
2123
path: '/shaders',
2224
getParentRoute: () => rootRouteImport,
2325
} as any)
26+
const PlaygroundRoute = PlaygroundRouteImport.update({
27+
id: '/playground',
28+
path: '/playground',
29+
getParentRoute: () => rootRouteImport,
30+
} as any)
2431
const AboutRoute = AboutRouteImport.update({
2532
id: '/about',
2633
path: '/about',
@@ -41,6 +48,11 @@ const ShadersNameRoute = ShadersNameRouteImport.update({
4148
path: '/$name',
4249
getParentRoute: () => ShadersRoute,
4350
} as any)
51+
const ApiPlaygroundSplatRoute = ApiPlaygroundSplatRouteImport.update({
52+
id: '/api/playground/$',
53+
path: '/api/playground/$',
54+
getParentRoute: () => rootRouteImport,
55+
} as any)
4456
const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
4557
id: '/api/auth/$',
4658
path: '/api/auth/$',
@@ -50,53 +62,72 @@ const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
5062
export interface FileRoutesByFullPath {
5163
'/': typeof IndexRoute
5264
'/about': typeof AboutRoute
65+
'/playground': typeof PlaygroundRoute
5366
'/shaders': typeof ShadersRouteWithChildren
5467
'/shaders/$name': typeof ShadersNameRoute
5568
'/shaders/': typeof ShadersIndexRoute
5669
'/api/auth/$': typeof ApiAuthSplatRoute
70+
'/api/playground/$': typeof ApiPlaygroundSplatRoute
5771
}
5872
export interface FileRoutesByTo {
5973
'/': typeof IndexRoute
6074
'/about': typeof AboutRoute
75+
'/playground': typeof PlaygroundRoute
6176
'/shaders/$name': typeof ShadersNameRoute
6277
'/shaders': typeof ShadersIndexRoute
6378
'/api/auth/$': typeof ApiAuthSplatRoute
79+
'/api/playground/$': typeof ApiPlaygroundSplatRoute
6480
}
6581
export interface FileRoutesById {
6682
__root__: typeof rootRouteImport
6783
'/': typeof IndexRoute
6884
'/about': typeof AboutRoute
85+
'/playground': typeof PlaygroundRoute
6986
'/shaders': typeof ShadersRouteWithChildren
7087
'/shaders/$name': typeof ShadersNameRoute
7188
'/shaders/': typeof ShadersIndexRoute
7289
'/api/auth/$': typeof ApiAuthSplatRoute
90+
'/api/playground/$': typeof ApiPlaygroundSplatRoute
7391
}
7492
export interface FileRouteTypes {
7593
fileRoutesByFullPath: FileRoutesByFullPath
7694
fullPaths:
7795
| '/'
7896
| '/about'
97+
| '/playground'
7998
| '/shaders'
8099
| '/shaders/$name'
81100
| '/shaders/'
82101
| '/api/auth/$'
102+
| '/api/playground/$'
83103
fileRoutesByTo: FileRoutesByTo
84-
to: '/' | '/about' | '/shaders/$name' | '/shaders' | '/api/auth/$'
104+
to:
105+
| '/'
106+
| '/about'
107+
| '/playground'
108+
| '/shaders/$name'
109+
| '/shaders'
110+
| '/api/auth/$'
111+
| '/api/playground/$'
85112
id:
86113
| '__root__'
87114
| '/'
88115
| '/about'
116+
| '/playground'
89117
| '/shaders'
90118
| '/shaders/$name'
91119
| '/shaders/'
92120
| '/api/auth/$'
121+
| '/api/playground/$'
93122
fileRoutesById: FileRoutesById
94123
}
95124
export interface RootRouteChildren {
96125
IndexRoute: typeof IndexRoute
97126
AboutRoute: typeof AboutRoute
127+
PlaygroundRoute: typeof PlaygroundRoute
98128
ShadersRoute: typeof ShadersRouteWithChildren
99129
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
130+
ApiPlaygroundSplatRoute: typeof ApiPlaygroundSplatRoute
100131
}
101132

102133
declare module '@tanstack/solid-router' {
@@ -108,6 +139,13 @@ declare module '@tanstack/solid-router' {
108139
preLoaderRoute: typeof ShadersRouteImport
109140
parentRoute: typeof rootRouteImport
110141
}
142+
'/playground': {
143+
id: '/playground'
144+
path: '/playground'
145+
fullPath: '/playground'
146+
preLoaderRoute: typeof PlaygroundRouteImport
147+
parentRoute: typeof rootRouteImport
148+
}
111149
'/about': {
112150
id: '/about'
113151
path: '/about'
@@ -136,6 +174,13 @@ declare module '@tanstack/solid-router' {
136174
preLoaderRoute: typeof ShadersNameRouteImport
137175
parentRoute: typeof ShadersRoute
138176
}
177+
'/api/playground/$': {
178+
id: '/api/playground/$'
179+
path: '/api/playground/$'
180+
fullPath: '/api/playground/$'
181+
preLoaderRoute: typeof ApiPlaygroundSplatRouteImport
182+
parentRoute: typeof rootRouteImport
183+
}
139184
'/api/auth/$': {
140185
id: '/api/auth/$'
141186
path: '/api/auth/$'
@@ -162,8 +207,10 @@ const ShadersRouteWithChildren =
162207
const rootRouteChildren: RootRouteChildren = {
163208
IndexRoute: IndexRoute,
164209
AboutRoute: AboutRoute,
210+
PlaygroundRoute: PlaygroundRoute,
165211
ShadersRoute: ShadersRouteWithChildren,
166212
ApiAuthSplatRoute: ApiAuthSplatRoute,
213+
ApiPlaygroundSplatRoute: ApiPlaygroundSplatRoute,
167214
}
168215
export const routeTree = rootRouteImport
169216
._addFileChildren(rootRouteChildren)

apps/web/src/routes/playground.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function PlaygroundPage() {
4545
() => session(),
4646
(s) => {
4747
if (isServer || !s) return
48-
if (!search.session) {
48+
if (search.session !== s.id) {
4949
navigate({ search: { session: s.id }, replace: true })
5050
}
5151
},

0 commit comments

Comments
 (0)