/// import type { QueryClient } from "@tanstack/react-query" import { Outlet, ScrollRestoration, createRootRouteWithContext, } from "@tanstack/react-router" import { Body, Head, Html, Meta, Scripts } from "@tanstack/start" import * as React from "react" import { fetchClerkAuth } from "~/actions" import { DefaultCatchBoundary } from "~/components/DefaultCatchBoundary.js" import { NotFound } from "~/components/NotFound.js" import appCss from "~/styles/app.css?url" export const TanStackRouterDevtools = process.env.NODE_ENV === "production" ? () => null : React.lazy(() => import("@tanstack/router-devtools").then((res) => ({ default: res.TanStackRouterDevtools, })), ) export const ReactQueryDevtools = process.env.NODE_ENV === "production" ? () => null : React.lazy(() => import("@tanstack/react-query-devtools/production").then((d) => ({ default: d.ReactQueryDevtools, })), ) export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({ meta: () => [ { charSet: "utf-8", }, { name: "viewport", content: "width=device-width, initial-scale=1", }, ], links: () => [ { rel: "stylesheet", href: appCss }, { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png", }, { rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png", }, { rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png", }, { rel: "manifest", href: "/site.webmanifest", color: "#fffff" }, { rel: "icon", href: "/favicon.ico" }, ], beforeLoad: async ({ cause }) => { if (cause !== "stay") { const auth = await fetchClerkAuth() return { auth } } return { auth: null, } }, errorComponent: (props) => { return ( ) }, notFoundComponent: () => , component: RootComponent, }) function RootComponent() { return ( ) } function RootDocument({ children }: { children: React.ReactNode }) { return ( {children} ) }