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