forked from project-openubl/xhandler-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Carlos Feria <[email protected]>
- Loading branch information
1 parent
f2f2c42
commit f43a185
Showing
1 changed file
with
39 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,54 @@ | ||
import { Outlet, createRootRoute } from "@tanstack/react-router"; | ||
import { TanStackRouterDevtools } from "@tanstack/router-devtools"; | ||
import React, { Suspense } from "react"; | ||
|
||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; | ||
import { Outlet, createRootRoute } from "@tanstack/react-router"; | ||
|
||
import { NotificationsProvider } from "@app/components/NotificationsProvider.tsx"; | ||
import { DefaultLayout } from "@app/layout"; | ||
|
||
import "@patternfly/patternfly/patternfly.css"; | ||
import "@patternfly/patternfly/patternfly-addons.css"; | ||
import "@patternfly/patternfly/patternfly.css"; | ||
|
||
const TanStackQueryDevtools = | ||
process.env.NODE_ENV === "production" | ||
? () => null | ||
: React.lazy(() => | ||
import("@tanstack/react-query-devtools").then((res) => ({ | ||
default: res.ReactQueryDevtools, | ||
})), | ||
); | ||
|
||
const TanStackRouterDevtools = | ||
process.env.NODE_ENV === "production" | ||
? () => null | ||
: React.lazy(() => | ||
import("@tanstack/router-devtools").then((res) => ({ | ||
default: res.TanStackRouterDevtools, | ||
})), | ||
); | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
export const Route = createRootRoute({ | ||
component: RootComponent, | ||
component: RootComponent, | ||
}); | ||
|
||
function RootComponent() { | ||
return ( | ||
<> | ||
<QueryClientProvider client={queryClient}> | ||
<NotificationsProvider> | ||
<DefaultLayout> | ||
<Outlet /> | ||
</DefaultLayout> | ||
</NotificationsProvider> | ||
<TanStackRouterDevtools position="bottom-left" /> | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</QueryClientProvider> | ||
</> | ||
); | ||
return ( | ||
<> | ||
<QueryClientProvider client={queryClient}> | ||
<NotificationsProvider> | ||
<DefaultLayout> | ||
<Outlet /> | ||
</DefaultLayout> | ||
</NotificationsProvider> | ||
<Suspense> | ||
<TanStackQueryDevtools position="bottom" initialIsOpen={false} /> | ||
</Suspense> | ||
<Suspense> | ||
<TanStackRouterDevtools position="bottom-left" /> | ||
</Suspense> | ||
</QueryClientProvider> | ||
</> | ||
); | ||
} |