Files
resolutionflow/frontend/src/lib/routePrefetch.ts
chihlasm fc51ceb610 refactor: rename AssistantChatPage to CockpitPage, consume useAssistantSession hook
Replace all inline session management with the shared useAssistantSession
hook. Keep cockpit-specific state (triageMeta, workZonePct, steps, onboarding)
and handlers. Wire onSessionLoadedRef/onTriageUpdateRef callbacks. Add feature
flag redirect for flowpilot_cockpit. Update router and prefetch references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:29:42 +00:00

28 lines
1.1 KiB
TypeScript

import { prefetchRoute } from '@/lib/prefetch'
/** Map of base route paths to their lazy import functions for hover-prefetching */
const PREFETCH_MAP: Record<string, () => Promise<unknown>> = {
'/': () => import('@/pages/QuickStartPage'),
'/trees': () => import('@/pages/TreeLibraryPage'),
'/my-trees': () => import('@/pages/MyTreesPage'),
'/sessions': () => import('@/pages/SessionHistoryPage'),
'/shares': () => import('@/pages/MySharesPage'),
'/analytics': () => import('@/pages/TeamAnalyticsPage'),
'/analytics/me': () => import('@/pages/MyAnalyticsPage'),
'/assistant': () => import('@/pages/CockpitPage'),
'/step-library': () => import('@/pages/StepLibraryPage'),
'/guides': () => import('@/pages/GuidesHubPage'),
'/feedback': () => import('@/pages/FeedbackPage'),
'/account': () => import('@/pages/AccountSettingsPage'),
}
/** Prefetch the chunk for a route on hover/focus */
export function prefetchForRoute(path: string) {
// Strip query params for lookup
const basePath = path.split('?')[0]
const importFn = PREFETCH_MAP[basePath]
if (importFn) {
prefetchRoute(importFn)
}
}