Skip to content

Commit

Permalink
integrate react query devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbarker committed Dec 25, 2024
1 parent 6d65b19 commit dc99034
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
35 changes: 25 additions & 10 deletions app/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@ import { Meta, Scripts } from "@tanstack/start";
import * as React from "react";
import type { ReactNode } from "react";

// Render nothing in prod, lazy load in dev
const MaybeTanStackRouterDevtools =
process.env.NODE_ENV === "production"
? () => null
: React.lazy(() =>
import("@tanstack/router-devtools").then((res) => ({
default: res.TanStackRouterDevtools,
})),
);
const inProduction = process.env.NODE_ENV === "production";

const MaybeTanStackRouterDevtools = inProduction
? () => null
: React.lazy(() =>
import("@tanstack/router-devtools").then((res) => ({
default: res.TanStackRouterDevtools,
})),
);

const MaybeReactQueryDevtools = inProduction
? () => null
: React.lazy(() =>
import("@tanstack/react-query-devtools").then((res) => ({
default: res.ReactQueryDevtools,
})),
);

const TanStackRouterDevtools = () => (
<React.Suspense>
<MaybeTanStackRouterDevtools position="bottom-right" />
<MaybeTanStackRouterDevtools />
</React.Suspense>
);

const ReactQueryDevtools = () => (
<React.Suspense>
<MaybeReactQueryDevtools position="right" />
</React.Suspense>
);

Expand Down Expand Up @@ -52,6 +66,7 @@ function RootComponent() {
<RootDocument>
<QueryClientProvider client={queryClient}>
<Outlet />
<ReactQueryDevtools />
<TanStackRouterDevtools />
</QueryClientProvider>
</RootDocument>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@happy-dom/global-registrator": "^15.11.7",
"@tanstack/react-query-devtools": "^5.62.10",
"@tanstack/router-devtools": "^1.92.3",
"@tanstack/router-plugin": "^1.91.1",
"@testing-library/dom": "^10.4.0",
Expand Down

0 comments on commit dc99034

Please sign in to comment.