diff --git a/inertia/pages/dashboard.tsx b/inertia/pages/dashboard.tsx index cc47e4f..dc8e762 100644 --- a/inertia/pages/dashboard.tsx +++ b/inertia/pages/dashboard.tsx @@ -397,7 +397,7 @@ export default function Dashboard({ value={stats.tvShows} icon={Tv01Icon} subtitle={`${stats.episodes.toLocaleString()} episodes`} - href="/library?tab=tvshows" + href="/library?tab=tv" /> ('all') const [sortBy, setSortBy] = useState('name') - // Read initial tab from URL - const initialTab = - typeof window !== 'undefined' - ? (new URLSearchParams(window.location.search).get('tab') as MediaType) || 'movies' + // Read initial tab from URL (validate against known types to prevent crashes) + const initialTab = (() => { + if (typeof window === 'undefined') return 'movies' as MediaType + const urlTab = new URLSearchParams(window.location.search).get('tab') + return urlTab && MEDIA_TYPE_ORDER.includes(urlTab as MediaType) + ? (urlTab as MediaType) : 'movies' + })() const [activeTab, setActiveTabState] = useState(initialTab) // Sync active tab to URL and reset filters