Support using alt+click on prev/next to jump to previous/next album in queue (#2220)

This commit is contained in:
Damien Erambert
2026-07-15 22:27:40 -07:00
committed by GitHub
parent 62c1ac04e4
commit 5e79e385d9
14 changed files with 179 additions and 46 deletions
+9 -9
View File
@@ -342,31 +342,31 @@ export const sortSongsByFetchedOrder = (
// Group songs by the fetched ID they belong to
const songsByFetchedId = new Map<string, Song[]>();
const fetchedIdsSet = new Set(fetchedIds);
for (const song of songs) {
let matchedId: string | undefined;
switch (itemType) {
case LibraryItem.ALBUM:
matchedId = fetchedIds.find((id) => song.albumId === id);
matchedId = fetchedIdsSet.has(song.albumId) ? song.albumId : undefined;
break;
case LibraryItem.ALBUM_ARTIST:
matchedId = fetchedIds.find((id) =>
song.albumArtists.some((artist) => artist.id === id),
);
matchedId = song.albumArtists.find((a) => fetchedIdsSet.has(a.id))?.id;
break;
case LibraryItem.ARTIST:
matchedId = fetchedIds.find((id) =>
song.artists.some((artist) => artist.id === id),
);
matchedId = song.artists.find((a) => fetchedIdsSet.has(a.id))?.id;
break;
case LibraryItem.GENRE:
matchedId = fetchedIds.find((id) => song.genres.some((genre) => genre.id === id));
matchedId = song.genres.find((a) => fetchedIdsSet.has(a.id))?.id;
break;
case LibraryItem.PLAYLIST:
// For playlists, we might need to track which playlist each song came from
// This is a simplified approach - you may need to adjust based on your data structure
matchedId = fetchedIds.find((id) => song.playlistItemId === id);
matchedId =
song.playlistItemId && fetchedIdsSet.has(song.playlistItemId)
? song.playlistItemId
: undefined;
break;
default:
break;