Skip to content

Commit

Permalink
fix: render devtools only in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Feb 17, 2025
1 parent 3ac265a commit 7a34c9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 19 additions & 0 deletions web/src/components/DevTools.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { lazy } from 'react'

export const TanStackRouterDevtools = process.env.NODE_ENV === 'production'
? () => null
: lazy(() =>
import('@tanstack/router-devtools').then((res) => ({
default: res.TanStackRouterDevtools,
// For Embedded Mode
// default: res.TanStackRouterDevtoolsPanel
}))
)

export const ReactQueryDevtools = process.env.NODE_ENV === 'production'
? () => null
: lazy(() =>
import('@tanstack/react-query-devtools').then((res) => ({
default: res.ReactQueryDevtools,
}))
)
5 changes: 2 additions & 3 deletions web/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { Outlet } from '@tanstack/react-router'
import { TanStackRouterDevtools } from '@tanstack/router-devtools'
import { ReactQueryDevtools, TanStackRouterDevtools } from 'c/DevTools'
import { Footer } from 'c/Footer'
import { Header } from 'c/Header'
import { Footer } from './Footer'

export function Layout() {
return (
Expand Down

0 comments on commit 7a34c9f

Please sign in to comment.