diff --git a/apps/readest-app/src/hooks/useAppRouter.ts b/apps/readest-app/src/hooks/useAppRouter.ts index f973cf8e..4600e051 100644 --- a/apps/readest-app/src/hooks/useAppRouter.ts +++ b/apps/readest-app/src/hooks/useAppRouter.ts @@ -5,13 +5,13 @@ import { useTransitionRouter } from 'next-view-transitions'; const isWebDevMode = process.env['NODE_ENV'] === 'development' && process.env['NEXT_PUBLIC_APP_PLATFORM'] === 'web'; -export const useAppRouter = () => { +const usePlainAppRouter = () => useRouter(); + +const useTransitionAppRouter = () => { const { appService } = useEnv(); const transitionRouter = useTransitionRouter(); const plainRouter = useRouter(); - if (isWebDevMode) return plainRouter; - // A route transition is a plain full-page crossfade, so it only needs the // base View Transitions API - not the nested view-transition groups the // paginator turns require. Route through the transition router wherever the @@ -20,3 +20,5 @@ export const useAppRouter = () => { // seen on unsupported webviews (Sentry READEST-9). return appService?.supportsViewTransitionsAPI ? transitionRouter : plainRouter; }; + +export const useAppRouter = isWebDevMode ? usePlainAppRouter : useTransitionAppRouter;