fix(ui): load album download status on grid view load
Load download status for all albums when they are first loaded in grid views (Home, Search, Artist Detail, Favorites) so the 'Download Album' menu shows correct state immediately. cp
This commit is contained in:
1 parent
a1e9ced027
commit
87f8980323
4 files changed
+49
-6
No files matched your search
@@ -129,6 +129,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAllAlbumDownloadStatuses(albums: { id: string }[]) {
|
||||
if (!checkAlbumFullyDownloaded || albums.length === 0) return;
|
||||
await Promise.all(albums.map(album => loadAlbumDownloadStatus(album.id)));
|
||||
}
|
||||
|
||||
function isAlbumDownloaded(albumId: string): boolean {
|
||||
void downloadStateVersion;
|
||||
return albumDownloadStatuses.get(albumId) || false;
|
||||
@@ -284,6 +289,7 @@
|
||||
favoriteTracks = items as FavoriteTrack[];
|
||||
} else if (type === 'albums') {
|
||||
favoriteAlbums = items as FavoriteAlbum[];
|
||||
await loadAllAlbumDownloadStatuses(favoriteAlbums);
|
||||
} else if (type === 'artists') {
|
||||
favoriteArtists = items as FavoriteArtist[];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user