Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

root.tsx

62 lines1.5 KB

1// @refresh reload
2import { Suspense } from 'solid-js'
3import {
4 A,
5 Body,
6 ErrorBoundary,
7 FileRoutes,
8 Head,
9 Html,
10 Meta,
11 Routes,
12 Scripts,
13 Title,
14} from 'solid-start'
15import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
16import './root.css'
17​
18import { QueryClient, QueryClientProvider } from '@tanstack/solid-query'
19​
20export default function Root() {
21 const queryClient = new QueryClient({
22 defaultOptions: {
23 queries: {
24 retry: false,
25 staleTime: 5000,
26 },
27 },
28 })
29​
30 return (
31 <Html lang="en">
32 <Head>
33 <Title>SolidStart - Bare</Title>
34 <Meta charset="utf-8" />
35 <Meta name="viewport" content="width=device-width, initial-scale=1" />
36 </Head>
37 <Body>
38 <QueryClientProvider client={queryClient}>
39 <SolidQueryDevtools />
40 <ErrorBoundary>
41 <Suspense
42 fallback={<div>loading... [root.tsx suspense boundary]</div>}
43 >
44 <A href="/">Home</A>
45 <A href="/streamed">Streamed</A>
46 <A href="/deferred">Deferred</A>
47 <A href="/mixed">Mixed</A>
48 <A href="/with-error">With Error</A>
49 <A href="/hydration">Hydration</A>
50 <A href="/prefetch">Prefetch</A>
51​
52 <Routes>
53 <FileRoutes />
54 </Routes>
55 </Suspense>
56 </ErrorBoundary>
57 </QueryClientProvider>
58 <Scripts />
59 </Body>
60 </Html>
61 )