fix(queue): complete album_id and artist_id propagation for track navigation

Ensure album_id and artist_id are passed through all queue track creation paths:
- trackActions.ts build functions (Qobuz, album, playlist, local tracks)
- Session persistence (both frontend and Rust backend)
- buildAlbumQueueTrack wrapper function
- Session restoration
This commit is contained in:
vicrodh committed 2026-01-23 03:56:14 -06:00
1 parent 2ea767f37c
commit 1684df7752
4 files changed
+79 -16

No files matched your search

+3
View File
@@ -17,6 +17,9 @@ export interface PersistedQueueTrack {
hires?: boolean;
bit_depth?: number | null;
sample_rate?: number | null;
is_local?: boolean;
album_id?: string | null;
artist_id?: number | null;
}
export interface PersistedSession {
+20 -5
View File
@@ -37,11 +37,20 @@ export function buildQueueTrackFromQobuz(track: QobuzTrack): BackendQueueTrack {
hires: track.hires_streamable ?? false,
bit_depth: track.maximum_bit_depth ?? null,
sample_rate: track.maximum_sampling_rate ?? null,
is_local: false
is_local: false,
album_id: track.album?.id || null,
artist_id: track.performer?.id ?? null
};
}
export function buildQueueTrackFromAlbumTrack(track: Track, albumArtwork: string, albumArtist: string, albumTitle: string): BackendQueueTrack {
export function buildQueueTrackFromAlbumTrack(
track: Track,
albumArtwork: string,
albumArtist: string,
albumTitle: string,
albumId?: string,
artistId?: number
): BackendQueueTrack {
return {
id: track.id,
title: track.title,
@@ -52,7 +61,9 @@ export function buildQueueTrackFromAlbumTrack(track: Track, albumArtwork: string
hires: track.hires ?? false,
bit_depth: track.bitDepth ?? null,
sample_rate: track.samplingRate ?? null,
is_local: false
is_local: false,
album_id: track.albumId || albumId || null,
artist_id: track.artistId ?? artistId ?? null
};
}
@@ -67,7 +78,9 @@ export function buildQueueTrackFromPlaylistTrack(track: PlaylistTrack): BackendQ
hires: track.hires ?? false,
bit_depth: track.bitDepth ?? null,
sample_rate: track.samplingRate ?? null,
is_local: false
is_local: false,
album_id: track.albumId || null,
artist_id: track.artistId ?? null
};
}
@@ -85,7 +98,9 @@ export function buildQueueTrackFromLocalTrack(track: LocalLibraryTrack): Backend
hires: isHires,
bit_depth: track.bit_depth ?? null,
sample_rate: track.sample_rate ?? null,
is_local: true
is_local: true,
album_id: null, // Local tracks don't have Qobuz album IDs
artist_id: null // Local tracks don't have Qobuz artist IDs
};
}
+24 -8
View File
@@ -518,7 +518,9 @@
track,
selectedAlbum?.artwork || '',
selectedAlbum?.artist || 'Unknown Artist',
selectedAlbum?.title || ''
selectedAlbum?.title || '',
selectedAlbum?.id,
selectedAlbum?.artistId
);
}
@@ -548,7 +550,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: album.id,
artist_id: t.artistId ?? album.artistId
}));
await setQueue(queueTracks, 0, true);
@@ -591,7 +595,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: album.id,
artist_id: t.artistId ?? album.artistId
});
}
showToast(`Playing ${album.tracks.length} tracks next`, 'success');
@@ -612,7 +618,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: album.id,
artist_id: t.artistId ?? album.artistId
}));
const success = await addTracksToQueue(queueTracks);
@@ -743,7 +751,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: selectedAlbum?.id,
artist_id: t.artistId ?? selectedAlbum?.artistId
}));
console.log('[Album Queue] Mapped to', queueTracks.length, 'queue tracks, startIndex:', trackIndex);
@@ -1080,7 +1090,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: selectedAlbum?.id,
artist_id: t.artistId ?? selectedAlbum?.artistId
});
}
showToast(`Playing ${selectedAlbum.tracks.length} tracks next`, 'success');
@@ -1101,7 +1113,9 @@
hires: t.hires ?? false,
bit_depth: t.bitDepth ?? null,
sample_rate: t.samplingRate ?? null,
is_local: false
is_local: false,
album_id: selectedAlbum?.id,
artist_id: t.artistId ?? selectedAlbum?.artistId
}));
const success = await addTracksToQueue(queueTracks);
@@ -1529,7 +1543,9 @@
hires: t.hires ?? false,
bit_depth: t.bit_depth ?? null,
sample_rate: t.sample_rate ?? null,
is_local: t.is_local ?? false
is_local: t.is_local ?? false,
album_id: t.album_id ?? null,
artist_id: t.artist_id ?? null
}));
await setQueue(tracks, session.current_index ?? 0, true);