fix: backfill EPs & Singles when artist/page omits them (#149)

The Qobuz artist/page endpoint sometimes excludes the EP/single
release group from its response. When this happens, fetch them
explicitly via get_releases_grid as a non-blocking backfill.
This commit is contained in:
vicrodh committed 2026-03-07 22:20:49 -06:00
1 parent cffbce9faa
commit 765287817b
1 file changed
+16
+16
View File
@@ -837,6 +837,22 @@
artistSimilarArtists = response.similar_artists?.items || [];
navigateTo('artist');
hideToast();
// The artist/page endpoint sometimes omits EPs & Singles from its
// releases array. If they're missing, fetch them explicitly.
const hasEpGroup = (response.releases || []).some(
g => g.type === 'ep' || g.type === 'single'
);
if (!hasEpGroup && selectedArtist.epsSingles.length === 0) {
invoke<ReleasesGridResponse>('get_releases_grid', {
artistId, releaseType: 'ep', limit: 25, offset: 0
}).then(result => {
if (result.items.length > 0 && selectedArtist?.id === artistId) {
selectedArtist = appendPageReleases(selectedArtist, 'ep', result.items, result.has_more);
console.log(`[Artist] Backfilled ${result.items.length} EPs & Singles`);
}
}).catch(err => console.debug('[Artist] EP backfill failed:', err));
}
} catch (err) {
console.error('Failed to load artist:', err);
showToast($t('toast.failedLoadArtist'), 'error');