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
@@ -132,6 +132,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;
|
||||
@@ -159,8 +164,19 @@
|
||||
loadTopTracks();
|
||||
loadSimilarArtists();
|
||||
checkFavoriteStatus();
|
||||
loadArtistAlbumDownloadStatuses();
|
||||
});
|
||||
|
||||
async function loadArtistAlbumDownloadStatuses() {
|
||||
const allAlbums = [
|
||||
...artist.albums,
|
||||
...artist.epsSingles,
|
||||
...artist.liveAlbums,
|
||||
...artist.compilations
|
||||
];
|
||||
await loadAllAlbumDownloadStatuses(allAlbums);
|
||||
}
|
||||
|
||||
async function checkFavoriteStatus() {
|
||||
try {
|
||||
const response = await invoke<{ artists?: { items: Array<{ id: number }> } }>('get_favorites', {
|
||||
|
||||
Reference in new issue
Block a user