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 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 02:32:50 -04:00
parent 406ee0ef97
commit 857d73e3d0
2 changed files with 13 additions and 11 deletions

View File

@@ -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 <Navigate to={sessionId ? `/pilot/${sessionId}` : '/pilot'} replace />
}

View File

@@ -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<React.ComponentType>) {
)
}
/**
* 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 <Navigate to={sessionId ? `/pilot/${sessionId}` : '/pilot'} replace />
}
export const router = sentryCreateBrowserRouter([
{
path: '/landing',