From 15dbcda3bbd258ad5221995c7943ff7f483358b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Fern=C3=A1ndez?= Date: Mon, 30 Dec 2024 14:05:51 +0000 Subject: [PATCH] fix: artist tracks not being listed correctly --- .../components/Layout/Artist/ArtistTab.vue | 6 ++-- frontend/src/pages/artist/[itemId].vue | 32 +++++++++++++------ frontend/src/pages/series/[itemId].vue | 4 +-- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/Layout/Artist/ArtistTab.vue b/frontend/src/components/Layout/Artist/ArtistTab.vue index 16c6c9cae89..4ed6a0081e3 100644 --- a/frontend/src/components/Layout/Artist/ArtistTab.vue +++ b/frontend/src/components/Layout/Artist/ArtistTab.vue @@ -35,7 +35,7 @@ class="my-2"> @@ -48,8 +48,8 @@ import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client'; import { getItemDetailsLink } from '@/utils/items'; -const { releases } = defineProps<{ - tracks: BaseItemDto[]; +const { releases, tracksByRelease } = defineProps<{ + tracksByRelease: Map; releases: BaseItemDto[]; }>(); diff --git a/frontend/src/pages/artist/[itemId].vue b/frontend/src/pages/artist/[itemId].vue index 45419760341..466eaad8b42 100644 --- a/frontend/src/pages/artist/[itemId].vue +++ b/frontend/src/pages/artist/[itemId].vue @@ -76,22 +76,22 @@ class="bg-transparent"> @@ -180,8 +180,7 @@ const [ { data: relatedItems }, { data: discography }, { data: appearances }, - { data: musicVideos }, - { data: tracks } + { data: musicVideos } ] = await Promise.all([ useBaseItem(getUserLibraryApi, 'getItem')(() => ({ itemId: route.params.itemId @@ -211,13 +210,26 @@ const [ sortOrder: [SortOrder.Descending], recursive: true, includeItemTypes: [BaseItemKind.MusicVideo] - })), + })) +]); + +const all_tracks = await Promise.all(discography.value.map(album => useBaseItem(getItemsApi, 'getItems')(() => ({ - parentId: route.params.itemId, + parentId: album.Id, sortBy: ['SortName'], sortOrder: [SortOrder.Ascending] - })) -]); + }))) +); + +const tracksByRelease = computed(() => { + const map = new Map(); + + for (let i = 0; i < discography.value.length; i++) { + map.set(discography.value[i]!.Id, all_tracks[i]!.data.value); + } + + return map; +}); const singles = computed(() => discography.value.filter( diff --git a/frontend/src/pages/series/[itemId].vue b/frontend/src/pages/series/[itemId].vue index 32a48a4ea9a..a142df22d39 100644 --- a/frontend/src/pages/series/[itemId].vue +++ b/frontend/src/pages/series/[itemId].vue @@ -221,8 +221,8 @@ const seasonsData = await Promise.all(seasons.value.map(s => const seasonEpisodes = computed(() => { const map = new Map(); - for (const [index, season] of seasons.value.entries()) { - map.set(season.Id, seasonsData[index]!.data.value); + for (let i = 0; i < seasons.value.length; i++) { + map.set(seasons.value[i]!.Id, seasonsData[i]!.data.value); } return map;