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:
2 files changed
+14
-1
No files matched your search
@@ -45,7 +45,8 @@ export type ViewType =
|
|||||||
| 'mixtapes'
|
| 'mixtapes'
|
||||||
| 'collections'
|
| 'collections'
|
||||||
| 'mixtape-detail'
|
| 'mixtape-detail'
|
||||||
| 'discography-builder';
|
| 'discography-builder'
|
||||||
|
| 'offline-manager';
|
||||||
export type FavoritesTab = 'tracks' | 'albums' | 'artists' | 'labels' | 'playlists';
|
export type FavoritesTab = 'tracks' | 'albums' | 'artists' | 'labels' | 'playlists';
|
||||||
|
|
||||||
// History entry: view + optional item identifier for granular back/forward
|
// History entry: view + optional item identifier for granular back/forward
|
||||||
|
|||||||
@@ -193,6 +193,7 @@
|
|||||||
import CollectionsView from '$lib/components/views/CollectionsView.svelte';
|
import CollectionsView from '$lib/components/views/CollectionsView.svelte';
|
||||||
import MixtapeCollectionDetailView from '$lib/components/views/MixtapeCollectionDetailView.svelte';
|
import MixtapeCollectionDetailView from '$lib/components/views/MixtapeCollectionDetailView.svelte';
|
||||||
import DiscographyBuilderView from '$lib/components/views/DiscographyBuilderView.svelte';
|
import DiscographyBuilderView from '$lib/components/views/DiscographyBuilderView.svelte';
|
||||||
|
import OfflineCacheManagerView from '$lib/components/views/OfflineCacheManagerView.svelte';
|
||||||
import {
|
import {
|
||||||
collectionsStore,
|
collectionsStore,
|
||||||
createCollection,
|
createCollection,
|
||||||
@@ -723,6 +724,11 @@
|
|||||||
return 'library';
|
return 'library';
|
||||||
case 'purchase-album':
|
case 'purchase-album':
|
||||||
return 'purchases';
|
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:
|
default:
|
||||||
return 'home';
|
return 'home';
|
||||||
}
|
}
|
||||||
@@ -6587,6 +6593,12 @@
|
|||||||
<p>No artist selected.</p>
|
<p>No artist selected.</p>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{:else if activeView === 'offline-manager'}
|
||||||
|
<OfflineCacheManagerView
|
||||||
|
onBack={() => navigateTo('settings')}
|
||||||
|
onGoToAlbum={(albumId) => handleAlbumClick(albumId)}
|
||||||
|
onGoToFavorites={() => navigateToFavorites()}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- Catch-all fallback: view has no matching data, show loading/error -->
|
<!-- Catch-all fallback: view has no matching data, show loading/error -->
|
||||||
<div class="view-error">
|
<div class="view-error">
|
||||||
|
|||||||
Reference in new issue
Block a user