fix(home): persist Release Watch in home cache so it renders on revisits
Release Watch is fetched from a REST endpoint separate from /discover/index, so it lives in its own state (releaseWatchAlbums / loadingReleaseWatch). HomeCacheData did not include it, so restoreFromCache on a 'fresh' hit populated every other section but left the Release Watch row stuck on its initial loading=true / empty-items state, showing dark skeleton boxes. Adds releaseWatchAlbums to HomeCacheData, writes it in setHomeCache, reads it back in restoreFromCache, and resets loadingReleaseWatch=false there so the row either renders populated or hides itself. cc
This commit is contained in:
2 files changed
+8
-1
No files matched your search
@@ -383,6 +383,7 @@
|
||||
qobuzPlaylists = cached.qobuzPlaylists;
|
||||
essentialDiscography = cached.essentialDiscography;
|
||||
playlistTags = cached.playlistTags;
|
||||
releaseWatchAlbums = cached.releaseWatchAlbums ?? [];
|
||||
|
||||
loadingNewReleases = false;
|
||||
loadingPressAwards = false;
|
||||
@@ -395,6 +396,7 @@
|
||||
loadingFavoriteAlbums = false;
|
||||
loadingQobuzPlaylists = false;
|
||||
loadingEssentialDiscography = false;
|
||||
loadingReleaseWatch = false;
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
if (homeViewEl && cached.scrollTop > 0) {
|
||||
@@ -405,7 +407,8 @@
|
||||
const allAlbums = [
|
||||
...cached.newReleases, ...cached.pressAwards, ...cached.mostStreamed,
|
||||
...cached.qobuzissimes, ...cached.editorPicks,
|
||||
...cached.recentAlbums, ...cached.favoriteAlbums
|
||||
...cached.recentAlbums, ...cached.favoriteAlbums,
|
||||
...(cached.releaseWatchAlbums ?? [])
|
||||
];
|
||||
loadAllAlbumDownloadStatusesBatch(allAlbums);
|
||||
}
|
||||
@@ -447,6 +450,7 @@
|
||||
newReleases, pressAwards, mostStreamed, qobuzissimes, editorPicks,
|
||||
recentAlbums, continueTracks, topArtists, favoriteAlbums,
|
||||
qobuzPlaylists, essentialDiscography, playlistTags,
|
||||
releaseWatchAlbums,
|
||||
genreIds
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ export interface HomeCacheData {
|
||||
essentialDiscography: DiscoverAlbum[];
|
||||
playlistTags: PlaylistTag[];
|
||||
|
||||
// Release Watch (REST /albums/releaseWatch)
|
||||
releaseWatchAlbums: AlbumCardData[];
|
||||
|
||||
// Metadata
|
||||
timestamp: number;
|
||||
genreIds: number[]; // snapshot of genre filter at cache time
|
||||
|
||||
Reference in new issue
Block a user