diff --git a/src/renderer/api/navidrome/navidrome-normalize.ts b/src/renderer/api/navidrome/navidrome-normalize.ts index 7bc33b7c..37dabeb7 100644 --- a/src/renderer/api/navidrome/navidrome-normalize.ts +++ b/src/renderer/api/navidrome/navidrome-normalize.ts @@ -99,7 +99,7 @@ const normalizeSong = ( item.rgAlbumGain || item.rgTrackGain ? { album: item.rgAlbumGain, track: item.rgTrackGain } : null, - genres: item.genres?.map((genre) => ({ + genres: (item.genres || []).map((genre) => ({ id: genre.id, imageUrl: null, itemType: LibraryItem.GENRE, @@ -162,7 +162,7 @@ const normalizeAlbum = ( comment: item.comment || null, createdAt: item.createdAt.split('T')[0], duration: item.duration * 1000 || null, - genres: item.genres?.map((genre) => ({ + genres: (item.genres || []).map((genre) => ({ id: genre.id, imageUrl: null, itemType: LibraryItem.GENRE, @@ -221,7 +221,7 @@ const normalizeAlbumArtist = ( backgroundImageUrl: null, biography: item.biography || null, duration: null, - genres: item.genres?.map((genre) => ({ + genres: (item.genres || []).map((genre) => ({ id: genre.id, imageUrl: null, itemType: LibraryItem.GENRE, diff --git a/src/renderer/api/navidrome/navidrome-types.ts b/src/renderer/api/navidrome/navidrome-types.ts index a61a2d1c..ba8eb14b 100644 --- a/src/renderer/api/navidrome/navidrome-types.ts +++ b/src/renderer/api/navidrome/navidrome-types.ts @@ -76,7 +76,7 @@ const albumArtist = z.object({ externalInfoUpdatedAt: z.string(), externalUrl: z.string(), fullText: z.string(), - genres: z.array(genre), + genres: z.array(genre).nullable(), id: z.string(), largeImageUrl: z.string().optional(), mbzArtistId: z.string().optional(), @@ -116,7 +116,7 @@ const album = z.object({ duration: z.number(), fullText: z.string(), genre: z.string(), - genres: z.array(genre), + genres: z.array(genre).nullable(), id: z.string(), maxYear: z.number(), mbzAlbumArtistId: z.string().optional(), @@ -180,7 +180,7 @@ const song = z.object({ externalUrl: z.string().optional(), fullText: z.string(), genre: z.string(), - genres: z.array(genre), + genres: z.array(genre).nullable(), hasCoverArt: z.boolean(), id: z.string(), imageFiles: z.string().optional(),