Skip to content

Commit

Permalink
fix(ui): Hide Router devtools in production
Browse files Browse the repository at this point in the history
Fixes eclipse-apoapsis#484.

Signed-off-by: Mikko Murto <[email protected]>
  • Loading branch information
mmurto committed Jul 3, 2024
1 parent f695828 commit 362912f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ui/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,26 @@
*/

import { createRootRouteWithContext, Outlet } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/router-devtools';
import React, { Suspense } from 'react';

import { RouterContext } from '@/app';

// Don't use Router devtools in production.
const TanStackRouterDevtools = import.meta.env.PROD
? () => null
: React.lazy(() =>
import('@tanstack/router-devtools').then((res) => ({
default: res.TanStackRouterDevtools,
}))
);

const RootComponent = () => {
return (
<>
<Outlet />
<TanStackRouterDevtools />
<Suspense>
<TanStackRouterDevtools />
</Suspense>
</>
);
};
Expand Down

0 comments on commit 362912f

Please sign in to comment.