feat(routing): add offline-manager view branch and exclude from last_view persistence

Wires the new OfflineCacheManagerView into +page.svelte's view switch with
onBack returning to settings, onGoToAlbum delegating to handleAlbumClick,
and onGoToFavorites returning to the user's last favorites tab. Adds
'offline-manager' to the ViewType union so the new branch type-checks.

Excludes 'offline-manager' from last_view persistence by routing it through
getSessionFallbackView('offline-manager') -> 'settings' (its entry point),
guarding against Phantom CSS Error Cause 3 on rehydration when the cache DB
is not yet ready at first paint.

cc
This commit is contained in:
vicrodh committed 2026-05-06 08:17:13 -06:00
1 parent 41ca8ea65b
commit ad0ae8cb0e
2 files changed
+14 -1

No files matched your search

+12
View File
@@ -193,6 +193,7 @@
import CollectionsView from '$lib/components/views/CollectionsView.svelte';
import MixtapeCollectionDetailView from '$lib/components/views/MixtapeCollectionDetailView.svelte';
import DiscographyBuilderView from '$lib/components/views/DiscographyBuilderView.svelte';
import OfflineCacheManagerView from '$lib/components/views/OfflineCacheManagerView.svelte';
import {
collectionsStore,
createCollection,
@@ -723,6 +724,11 @@
return 'library';
case 'purchase-album':
return 'purchases';
// Offline cache manager is intentionally NOT persisted as last_view to
// avoid Phantom CSS Error Cause 3 on rehydration when the cache DB is
// not yet ready at first paint. Fall back to settings (its entry point).
case 'offline-manager':
return 'settings';
default:
return 'home';
}
@@ -6587,6 +6593,12 @@
<p>No artist selected.</p>
</div>
{/if}
{:else if activeView === 'offline-manager'}
<OfflineCacheManagerView
onBack={() => navigateTo('settings')}
onGoToAlbum={(albumId) => handleAlbumClick(albumId)}
onGoToFavorites={() => navigateToFavorites()}
/>
{:else}
<!-- Catch-all fallback: view has no matching data, show loading/error -->
<div class="view-error">