From 857d73e3d03922da3110b6a722a86d66b9ee082d Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 25 Apr 2026 02:32:50 -0400 Subject: [PATCH] fix(lint): move AssistantSessionRedirect out of router.tsx (react-refresh gate) react-refresh/only-export-components fires when a file with the \`router\` const export also defines a component (the redirect helper). Moves the small helper to its own file under components/routing/ so HMR can keep the route-component module hot-reload-eligible. No behavior change. Co-Authored-By: Claude Opus 4.7 --- .../components/routing/AssistantSessionRedirect.tsx | 11 +++++++++++ frontend/src/router.tsx | 13 ++----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 frontend/src/components/routing/AssistantSessionRedirect.tsx diff --git a/frontend/src/components/routing/AssistantSessionRedirect.tsx b/frontend/src/components/routing/AssistantSessionRedirect.tsx new file mode 100644 index 00000000..555b8f08 --- /dev/null +++ b/frontend/src/components/routing/AssistantSessionRedirect.tsx @@ -0,0 +1,11 @@ +import { Navigate, useParams } from 'react-router-dom' + +/** + * Permanent 301-style redirect from /assistant/:sessionId to /pilot/:sessionId. + * Used by the Phase 1 route-rename; paired with a bare-path redirect to /pilot. + * SPA redirects replace history so the legacy URL does not linger in back-nav. + */ +export function AssistantSessionRedirect() { + const { sessionId } = useParams<{ sessionId: string }>() + return +} diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx index 9fb6cc46..44e4fa30 100644 --- a/frontend/src/router.tsx +++ b/frontend/src/router.tsx @@ -1,4 +1,5 @@ -import { createBrowserRouter, Navigate, useParams } from 'react-router-dom' +import { createBrowserRouter, Navigate } from 'react-router-dom' +import { AssistantSessionRedirect } from '@/components/routing/AssistantSessionRedirect' import * as Sentry from '@sentry/react' import { Suspense } from 'react' import { AppLayout, ProtectedRoute } from '@/components/layout' @@ -102,16 +103,6 @@ function page(Component: React.LazyExoticComponent) { ) } -/** - * Permanent 301-style redirect from /assistant/:sessionId to /pilot/:sessionId. - * Used by the Phase 1 route-rename; paired with a bare-path redirect to /pilot. - * SPA redirects replace history so the legacy URL does not linger in back-nav. - */ -function AssistantSessionRedirect() { - const { sessionId } = useParams<{ sessionId: string }>() - return -} - export const router = sentryCreateBrowserRouter([ { path: '/landing',