fix(artist): dedup releases by id in convertPageArtist initial load
appendPageReleases already skipped releases whose id already lived in artist.albums/epsSingles/liveAlbums/others, but convertPageArtist (the first /artist/page response) pushed everything blindly. When Qobuz returned the same release in multiple groups (e.g. both the main category and the 'download' distribution bucket) we ended up with side-by-side duplicates on the discography grid — reported by user on Holly Humberstone's 'Cruel World' entry. Adds a seenIds Set scoped to the whole response so a release is assigned to exactly one category on first encounter and silently dropped on subsequent references. totalAlbums is now counted per unique accepted item instead of raw group size, so the header count matches the rendered grid. cc
This commit is contained in:
1 file changed
+9
-1
@@ -706,6 +706,12 @@ export function convertPageArtist(response: PageArtistResponse): ArtistDetail {
|
||||
let totalAlbums = 0;
|
||||
const releaseHasMore: Record<string, boolean> = {};
|
||||
|
||||
// Dedup across categories AND across groups. /artist/page occasionally
|
||||
// returns the same release under multiple groups (e.g. an album also
|
||||
// listed under 'download') or repeated within the same group — that's
|
||||
// what produced the side-by-side duplicates on the discography grid.
|
||||
const seenIds = new Set<string>();
|
||||
|
||||
for (const group of releaseGroups) {
|
||||
const groupCategory = mapReleaseType(group.type);
|
||||
// Normalize the key so the UI can use consistent names (ep, not epSingle)
|
||||
@@ -714,6 +720,8 @@ export function convertPageArtist(response: PageArtistResponse): ArtistDetail {
|
||||
for (const release of group.items) {
|
||||
const summary = pageReleaseToSummary(release, response.id);
|
||||
if (!summary) continue;
|
||||
if (seenIds.has(summary.id)) continue;
|
||||
seenIds.add(summary.id);
|
||||
|
||||
// Only re-categorize items from the "download" group by their individual release_type,
|
||||
// since "download" is a distribution channel, not a content type.
|
||||
@@ -737,8 +745,8 @@ export function convertPageArtist(response: PageArtistResponse): ArtistDetail {
|
||||
others.push(summary);
|
||||
break;
|
||||
}
|
||||
totalAlbums += 1;
|
||||
}
|
||||
totalAlbums += group.items.length;
|
||||
}
|
||||
|
||||
// Build compilations from tracks_appears_on (albums by other artists featuring this artist)
|
||||
|
||||
Reference in new issue
Block a user