Open History to see the last commit
1/// <reference types="vite/client" />
2import {
3 ClientOnly,
4 HeadContent,
5 Link,
6 Scripts,
7 createRootRoute,
8 useRouterState,
9} from '@tanstack/solid-router'
10import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
11import { HydrationScript } from 'solid-js/web'
12import type { JSX } from 'solid-js'
13import appCss from '~/styles/app.css?url'
14β
15export const Route = createRootRoute({
16 head: () => ({
17 meta: [
18 {
19 charset: 'utf-8',
20 },
21 {
22 name: 'viewport',
23 content: 'width=device-width, initial-scale=1',
24 },
25 {
26 title: 'Serialization Adapters E2E Test',
27 },
28 ],
29 links: [{ rel: 'stylesheet', href: appCss }],
30 }),
31 shellComponent: RootDocument,
32 notFoundComponent: (e) => <div>404 - Not Found {JSON.stringify(e.data)}</div>,
33})
34β
35function RootDocument({ children }: { children: JSX.Element }) {
36 const { isLoading, status } = useRouterState({
37 select: (state) => ({ isLoading: state.isLoading, status: state.status }),
38 })()
39 return (
40 <html>
41 <head>
42 <HydrationScript />
43 </head>
44 <body>
45 <HeadContent />
46 <div class="p-2 flex gap-2 text-lg">
47 <h1>Serialization Adapters E2E Test</h1>
48 <Link
49 to="/"
50 activeProps={{
51 class: 'font-bold',
52 }}
53 >
54 Home
55 </Link>
56 </div>
57 <hr />
58 <ClientOnly>
59 <div>
60 router isLoading:{' '}
61 <b data-testid="router-isLoading">{isLoading ? 'true' : 'false'}</b>
62 </div>
63 <div>
64 router status: <b data-testid="router-status">{status}</b>
65 </div>
66 </ClientOnly>
67 <hr />
68 {children}
69 <Scripts />
70 <TanStackRouterDevtools position="bottom-right" />
71 </body>
72 </html>
73 )
74}