Skip to content

Commit

Permalink
🔧 Set TanStack Router devtools only in dev mode (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejsdev authored Mar 11, 2024
1 parent 8f9650b commit 710e2f8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import React, { Suspense } from 'react'
import { createRootRoute, Outlet } from '@tanstack/react-router'
import { TanStackRouterDevtools } from '@tanstack/router-devtools'

import NotFound from '../components/Common/NotFound'

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

export const Route = createRootRoute({
component: () => (
<>
<Outlet />
<TanStackRouterDevtools />
<Suspense>
<TanStackRouterDevtools />
</Suspense>
</>
),
notFoundComponent: () => <NotFound />,

0 comments on commit 710e2f8

Please sign in to comment.