chore: preload nested deps

This commit is contained in:
Aslam H
2024-11-13 22:27:43 +07:00
parent 7eda38955e
commit a44cf910b2
23 changed files with 231 additions and 234 deletions

View File

@@ -2,21 +2,17 @@ import { createRouter as createTanStackRouter } from "@tanstack/react-router"
import { routeTree } from "./routeTree.gen"
import { DefaultCatchBoundary } from "./components/DefaultCatchBoundary"
import { NotFound } from "./components/NotFound"
import { QueryClient } from "@tanstack/react-query"
import { routerWithQueryClient } from "@tanstack/react-router-with-query"
export function createRouter() {
const queryClient = new QueryClient()
const router = routerWithQueryClient(
createTanStackRouter({
routeTree,
defaultPreload: "intent",
defaultErrorComponent: DefaultCatchBoundary,
defaultNotFoundComponent: () => <NotFound />,
context: { queryClient, auth: undefined! },
}),
queryClient,
)
const router = createTanStackRouter({
routeTree,
defaultPreload: "intent",
defaultErrorComponent: DefaultCatchBoundary,
defaultNotFoundComponent: () => <NotFound />,
context: {
auth: undefined,
},
})
return router
}