fix: add catch handlers to all home section promise chains (#43)
Missing .catch() on 9 .then() chains in HomeView meant any rejected promise (e.g. 404 from a deleted track) would prevent markSectionFinished() from being called, leaving the loading overlay permanently visible. Each catch now logs the error, clears the loading flag, and calls markSectionFinished() so the overlay always dismisses.
This commit is contained in:
1 parent
1fce799674
commit
2bff1290a3
1 file changed
+46
@@ -312,6 +312,7 @@
|
|||||||
// Mark a section as finished loading and check if we can hide overlay
|
// Mark a section as finished loading and check if we can hide overlay
|
||||||
function markSectionFinished() {
|
function markSectionFinished() {
|
||||||
sectionsFinished++;
|
sectionsFinished++;
|
||||||
|
console.warn(`[DEBUG-43] markSectionFinished: ${sectionsFinished}/${totalVisibleSections}`);
|
||||||
checkAllSectionsReady();
|
checkAllSectionsReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,6 +746,11 @@
|
|||||||
newReleases = albums;
|
newReleases = albums;
|
||||||
await loadAllAlbumDownloadStatuses(albums);
|
await loadAllAlbumDownloadStatuses(albums);
|
||||||
loadingNewReleases = false;
|
loadingNewReleases = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: newReleases', albums.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: newReleases', err);
|
||||||
|
loadingNewReleases = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -756,6 +762,11 @@
|
|||||||
pressAwards = albums;
|
pressAwards = albums;
|
||||||
await loadAllAlbumDownloadStatuses(albums);
|
await loadAllAlbumDownloadStatuses(albums);
|
||||||
loadingPressAwards = false;
|
loadingPressAwards = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: pressAwards', albums.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: pressAwards', err);
|
||||||
|
loadingPressAwards = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -767,6 +778,11 @@
|
|||||||
mostStreamed = albums;
|
mostStreamed = albums;
|
||||||
await loadAllAlbumDownloadStatuses(albums);
|
await loadAllAlbumDownloadStatuses(albums);
|
||||||
loadingMostStreamed = false;
|
loadingMostStreamed = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: mostStreamed', albums.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: mostStreamed', err);
|
||||||
|
loadingMostStreamed = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -778,6 +794,11 @@
|
|||||||
qobuzissimes = albums;
|
qobuzissimes = albums;
|
||||||
await loadAllAlbumDownloadStatuses(albums);
|
await loadAllAlbumDownloadStatuses(albums);
|
||||||
loadingQobuzissimes = false;
|
loadingQobuzissimes = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: qobuzissimes', albums.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: qobuzissimes', err);
|
||||||
|
loadingQobuzissimes = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -789,6 +810,11 @@
|
|||||||
editorPicks = albums;
|
editorPicks = albums;
|
||||||
await loadAllAlbumDownloadStatuses(albums);
|
await loadAllAlbumDownloadStatuses(albums);
|
||||||
loadingEditorPicks = false;
|
loadingEditorPicks = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: editorPicks', albums.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: editorPicks', err);
|
||||||
|
loadingEditorPicks = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -814,6 +840,11 @@
|
|||||||
fetchTracks(seeds.continueListeningTrackIds).then(tracks => {
|
fetchTracks(seeds.continueListeningTrackIds).then(tracks => {
|
||||||
continueTracks = tracks;
|
continueTracks = tracks;
|
||||||
loadingContinueTracks = false;
|
loadingContinueTracks = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: continueTracks', tracks.length, 'tracks');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: continueTracks', err);
|
||||||
|
loadingContinueTracks = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -830,6 +861,11 @@
|
|||||||
recentAlbums = filtered;
|
recentAlbums = filtered;
|
||||||
await loadAllAlbumDownloadStatuses(filtered);
|
await loadAllAlbumDownloadStatuses(filtered);
|
||||||
loadingRecentAlbums = false;
|
loadingRecentAlbums = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: recentAlbums', filtered.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: recentAlbums', err);
|
||||||
|
loadingRecentAlbums = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -841,6 +877,11 @@
|
|||||||
fetchArtists(seeds.topArtistIds.slice(0, homeLimits.topArtists)).then(artists => {
|
fetchArtists(seeds.topArtistIds.slice(0, homeLimits.topArtists)).then(artists => {
|
||||||
topArtists = artists;
|
topArtists = artists;
|
||||||
loadingTopArtists = false;
|
loadingTopArtists = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: topArtists', artists.length, 'artists');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: topArtists', err);
|
||||||
|
loadingTopArtists = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -862,6 +903,11 @@
|
|||||||
favoriteAlbums = filtered;
|
favoriteAlbums = filtered;
|
||||||
await loadAllAlbumDownloadStatuses(filtered);
|
await loadAllAlbumDownloadStatuses(filtered);
|
||||||
loadingFavoriteAlbums = false;
|
loadingFavoriteAlbums = false;
|
||||||
|
console.warn('[DEBUG-43] section finished: favoriteAlbums', filtered.length, 'albums');
|
||||||
|
markSectionFinished();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('[DEBUG-43] section FAILED: favoriteAlbums', err);
|
||||||
|
loadingFavoriteAlbums = false;
|
||||||
markSectionFinished();
|
markSectionFinished();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user