Skip to content

Commit a4cd7bf

Browse files
simplify start-basic
1 parent 1a539c6 commit a4cd7bf

File tree

8 files changed

+1
-334
lines changed

8 files changed

+1
-334
lines changed

examples/react/start-basic/src/Foo.ts

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

examples/react/start-basic/src/routeTree.gen.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,10 @@ export const routeTree = rootRouteImport
438438
._addFileTypes<FileRouteTypes>()
439439

440440
import type { getRouter } from './router.tsx'
441-
import type { startInstance } from './start.tsx'
441+
import type { createStart } from '@tanstack/react-start'
442442
declare module '@tanstack/react-start' {
443443
interface Register {
444444
ssr: true
445445
router: Awaited<ReturnType<typeof getRouter>>
446-
config: Awaited<ReturnType<typeof startInstance.getOptions>>
447446
}
448447
}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createRouter } from '@tanstack/react-router'
2-
import { getGlobalStartContext } from '@tanstack/react-start'
32
import { routeTree } from './routeTree.gen'
43
import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
54
import { NotFound } from './components/NotFound'
@@ -11,9 +10,6 @@ export function getRouter() {
1110
defaultErrorComponent: DefaultCatchBoundary,
1211
defaultNotFoundComponent: () => <NotFound />,
1312
scrollRestoration: true,
14-
ssr: {
15-
nonce: getGlobalStartContext()?.nonce,
16-
},
1713
})
1814
return router
1915
}

examples/react/start-basic/src/routes/__root.tsx

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -9,140 +9,10 @@ import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
99
import * as React from 'react'
1010
import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'
1111
import { NotFound } from '~/components/NotFound'
12-
import { Test, startInstance } from '~/start'
1312
import appCss from '~/styles/app.css?url'
1413
import { seo } from '~/utils/seo'
1514

16-
export const testServerMw = startInstance
17-
.createMiddleware()
18-
.server(({ next, context }) => {
19-
context.fromFetch
20-
// ^?
21-
context.fromServerMw
22-
// ^?
23-
24-
return next({
25-
context: {
26-
fromIndexServerMw: true,
27-
},
28-
})
29-
})
30-
31-
export const testFnMw = startInstance
32-
.createMiddleware({ type: 'function' })
33-
.middleware([testServerMw])
34-
.server(({ next, context }) => {
35-
context.fromFetch
36-
// ^?
37-
context.fromServerMw
38-
// ^?
39-
context.fromFnMw
40-
// ^?
41-
context.fromIndexServerMw
42-
// ^?
43-
44-
return next({
45-
context: {
46-
fromIndexFnMw: true,
47-
},
48-
})
49-
})
50-
51-
export const testGetMiddleware = startInstance
52-
.createMiddleware()
53-
.server(({ next, context }) => {
54-
return next({
55-
context: {
56-
fromGetMiddleware: true,
57-
},
58-
})
59-
})
60-
6115
export const Route = createRootRoute({
62-
server: {
63-
middleware: [testServerMw],
64-
handlers: {
65-
GET: ({ context, next }) => {
66-
context.fromFetch
67-
// ^?
68-
context.fromServerMw
69-
// ^?
70-
context.fromIndexServerMw
71-
// ^?
72-
return next({
73-
context: {
74-
fromGet: true,
75-
},
76-
})
77-
},
78-
POST: ({ context, next }) => {
79-
context.fromFetch
80-
context.fromServerMw
81-
context.fromIndexServerMw
82-
return next({
83-
context: {
84-
fromPost: true,
85-
},
86-
})
87-
},
88-
},
89-
// handlers: ({ createHandlers }) =>
90-
// createHandlers({
91-
// GET: {
92-
// middleware: [testGetMiddleware],
93-
// handler: ({ context, next }) => {
94-
// context.fromFetch
95-
// // ^?
96-
// context.fromServerMw
97-
// // ^?
98-
// context.fromIndexServerMw
99-
// // ^?
100-
// context.fromGetMiddleware
101-
// // ^?
102-
// return next({
103-
// context: {
104-
// fromGet: true,
105-
// fromPost: false,
106-
// },
107-
// })
108-
// },
109-
// },
110-
// POST: {
111-
// handler: ({ next }) => {
112-
// return next({
113-
// context: {
114-
// fromGet: false,
115-
// fromPost: true,
116-
// },
117-
// })
118-
// },
119-
// },
120-
// }),
121-
test: (test) => {},
122-
},
123-
beforeLoad: ({ serverContext }) => {
124-
serverContext?.fromFetch
125-
// ^?
126-
serverContext?.fromServerMw
127-
// ^?
128-
serverContext?.fromIndexServerMw
129-
// ^?
130-
serverContext?.fromGet
131-
// ^?
132-
return serverContext
133-
},
134-
// ssr: false,
135-
loader: ({ context }) => {
136-
context?.fromFetch
137-
// ^?
138-
context?.fromServerMw
139-
// ^?
140-
context?.fromIndexServerMw
141-
// ^?
142-
context?.fromPost
143-
// ^?
144-
return new Test('test')
145-
},
14616
head: () => ({
14717
meta: [
14818
{

examples/react/start-basic/src/routes/index.tsx

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,6 @@
11
import { createFileRoute } from '@tanstack/react-router'
2-
import { Test } from '~/start'
32

43
export const Route = createFileRoute('/')({
5-
// server: {
6-
// handlers: {
7-
// GET: ({ context, next }) => {
8-
// context.fromFetch
9-
// // ^?
10-
// context.fromServerMw
11-
// // ^?
12-
// context.fromIndexServerMw
13-
// // ^?
14-
// return next({
15-
// context: {
16-
// fromGet: true,
17-
// },
18-
// })
19-
// },
20-
// POST: ({ context, next }) => {
21-
// context.fromFetch
22-
// context.fromServerMw
23-
// context.fromIndexServerMw
24-
// return next({
25-
// context: {
26-
// fromPost: true,
27-
// },
28-
// })
29-
// },
30-
// },
31-
// // handlers: ({ createHandlers }) =>
32-
// // createHandlers({
33-
// // GET: {
34-
// // middleware: [testGetMiddleware],
35-
// // handler: ({ context, next }) => {
36-
// // context.fromFetch
37-
// // // ^?
38-
// // context.fromServerMw
39-
// // // ^?
40-
// // context.fromIndexServerMw
41-
// // // ^?
42-
// // context.fromGetMiddleware
43-
// // // ^?
44-
// // return next({
45-
// // context: {
46-
// // fromGet: true,
47-
// // fromPost: false,
48-
// // },
49-
// // })
50-
// // },
51-
// // },
52-
// // POST: {
53-
// // handler: ({ next }) => {
54-
// // return next({
55-
// // context: {
56-
// // fromGet: false,
57-
// // fromPost: true,
58-
// // },
59-
// // })
60-
// // },
61-
// // },
62-
// // }),
63-
// test: (test) => {},
64-
// },
65-
loader: () => {
66-
return new Test('test')
67-
},
684
component: Home,
695
})
706

examples/react/start-basic/src/server.ts

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

examples/react/start-basic/src/start.tsx

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

examples/react/start-basic/vite.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import tsConfigPaths from 'vite-tsconfig-paths'
44
import viteReact from '@vitejs/plugin-react'
55

66
export default defineConfig({
7-
base: '/foo/',
87
server: {
98
port: 3000,
109
},
@@ -14,8 +13,6 @@ export default defineConfig({
1413
}),
1514
tanstackStart({
1615
srcDirectory: 'src',
17-
start: { entry: './start.tsx' },
18-
server: { entry: './server.ts' },
1916
}),
2017
viteReact(),
2118
],

0 commit comments

Comments
 (0)