import { Alpine } from "./alpine"; import { initLibrarySwitcher } from "./library-switcher"; // Rendering ownership (AGENTS.md): the series grid and its paginator are // rendered by templates/series.templ. This page intentionally has NO // TypeScript renderer — the old one here duplicated the templ markup via // innerHTML and re-fetched at hardcoded page 1, stomping SSR pagination // whenever the header's library restore fired. A library switch is a plain // SSR navigation so the URL stays the single source of truth for // library_id and page state. function navigateToSeries(libraryId: string): void { const param = libraryId ? `library_id=${encodeURIComponent(libraryId)}&` : ""; window.location.href = `/series?${param}page=1`; } Alpine.data("seriesPage", () => ({ initSeriesPage() { initLibrarySwitcher({ onSwitch: navigateToSeries, }); }, }));