This repository was archived by the owner on Jan 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.tsx
More file actions
75 lines (70 loc) · 2.25 KB
/
app.tsx
File metadata and controls
75 lines (70 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {
ConfigProvider,
FullscreenLoading,
Toaster,
TooltipProvider,
getConfig,
} from "@rivet-gg/components";
import { PageLayout } from "@rivet-gg/components/layout";
import * as Sentry from "@sentry/react";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
import { RouterProvider, createRouter } from "@tanstack/react-router";
import { Suspense } from "react";
import { ThirdPartyProviders } from "./components/third-party-providers";
import { AuthProvider, useAuth } from "./domains/auth/contexts/auth";
import { routeMasks } from "./lib/route-masks";
import { queryClient, queryClientPersister } from "./queries/global";
import { routeTree } from "./routeTree.gen";
declare module "@tanstack/react-router" {
interface Register {
router: typeof router;
}
interface StaticDataRouteOption {
layout?: "full" | "compact";
}
}
export const router = createRouter({
basepath: import.meta.env.BASE_URL,
routeTree,
routeMasks,
context: {
// biome-ignore lint/style/noNonNullAssertion: we know this will be defined
auth: undefined!,
queryClient,
},
// Since we're using React Query, we don't want loader calls to ever be stale
// This will ensure that the loader is always called when the route is preloaded or visited
defaultStaleTime: Number.POSITIVE_INFINITY,
defaultPendingComponent: PageLayout.Root.Skeleton,
defaultPreloadStaleTime: 0,
defaultOnCatch: (error) => {
Sentry.captureException(error);
},
});
function InnerApp() {
const auth = useAuth();
return <RouterProvider router={router} context={{ auth }} />;
}
export function App() {
return (
<PersistQueryClientProvider
client={queryClient}
persistOptions={{ persister: queryClientPersister }}
>
<ConfigProvider value={getConfig()}>
<ThirdPartyProviders>
<Suspense fallback={<FullscreenLoading />}>
<TooltipProvider>
<AuthProvider>
<InnerApp />
</AuthProvider>
</TooltipProvider>
</Suspense>
<Toaster />
<ReactQueryDevtools />
</ThirdPartyProviders>
</ConfigProvider>
</PersistQueryClientProvider>
);
}