Open History to see the last commit
1import { QueryClient } from '@tanstack/solid-query'
2import { createRouter } from '@tanstack/solid-router'
3import { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'
4import { routeTree } from './routeTree.gen'
5import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
6import { NotFound } from './components/NotFound'
7β
8export function getRouter() {
9 const queryClient = new QueryClient({
10 defaultOptions: {
11 queries: {
12 experimental_prefetchInRender: true,
13 },
14 },
15 })
16 const router = createRouter({
17 routeTree,
18 context: { queryClient },
19 scrollRestoration: true,
20 defaultPreload: 'intent',
21 defaultErrorComponent: DefaultCatchBoundary,
22 defaultNotFoundComponent: () => <NotFound />,
23 })
24 setupRouterSsrQueryIntegration({
25 router,
26 queryClient,
27 })
28 return router
29}