Browse Source

🔧 Set TanStack Router devtools only in dev mode (#668)

pull/13907/head
Alejandra 1 year ago
committed by GitHub
parent
commit
710e2f8c2b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      frontend/src/routes/__root.tsx

15
frontend/src/routes/__root.tsx

@ -1,13 +1,24 @@
import React, { Suspense } from 'react'
import { createRootRoute, Outlet } from '@tanstack/react-router' import { createRootRoute, Outlet } from '@tanstack/react-router'
import { TanStackRouterDevtools } from '@tanstack/router-devtools'
import NotFound from '../components/Common/NotFound' 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({ export const Route = createRootRoute({
component: () => ( component: () => (
<> <>
<Outlet /> <Outlet />
<TanStackRouterDevtools /> <Suspense>
<TanStackRouterDevtools />
</Suspense>
</> </>
), ),
notFoundComponent: () => <NotFound />, notFoundComponent: () => <NotFound />,

Loading…
Cancel
Save