Fix wishlist Download Selection ignoring checkbox selections

downloadSelectedCategory() was passing only the category name to the
download function, which fetched ALL tracks in that category. Now
collects checked track IDs from checkboxes BEFORE closing the modal
(DOM is destroyed on close), then filters the fetched tracks to only
the selected ones.

If nothing is checked, downloads the full category (same as before).
Other callers of openDownloadMissingWishlistModal are unaffected —
the new selectedTrackIds parameter defaults to null.
This commit is contained in:
Broque Thomas 2026-03-29 21:43:48 -07:00
parent 1b532503cb
commit 4e6b424bc7
3 changed files with 22 additions and 2 deletions

View file

@ -19071,6 +19071,15 @@ def get_version_info():
"title": "What's New in SoulSync",
"subtitle": f"Version {SOULSYNC_VERSION} — Latest Changes",
"sections": [
{
"title": "🔧 Fix Wishlist Download Selection Ignoring Checkboxes",
"description": "Download Selection now respects which tracks are checked in the wishlist overview",
"features": [
"• Selected track IDs are collected before closing the overview modal",
"• Only checked tracks are sent to the download analysis board",
"• If nothing is checked, downloads the full category (same as before)"
]
},
{
"title": "🔧 Fix Tidal OAuth Redirect URI in Docker",
"description": "Tidal OAuth now uses the configured redirect URI instead of the Docker container hostname",

View file

@ -3403,6 +3403,7 @@ function closeHelperSearch() {
const WHATS_NEW = {
'2.1': [
// Newest features first
{ title: 'Fix Wishlist Download Selection', desc: 'Download Selection now only downloads checked tracks instead of the entire category' },
{ title: 'Fix Tidal OAuth in Docker', desc: 'Tidal redirect URI now uses configured setting instead of Docker container hostname' },
{ title: 'High-Res Cover Art', desc: 'Album art now sourced from Cover Art Archive (1200x1200+) when MusicBrainz release ID is available' },
{ title: 'Embedded Lyrics', desc: 'Lyrics now embedded directly in audio file tags — Navidrome, Jellyfin, and Plex can display them' },

View file

@ -13039,11 +13039,15 @@ async function downloadSelectedCategory() {
return;
}
// Collect checked track IDs BEFORE closing the modal (checkboxes are destroyed on close)
const checkedBoxes = document.querySelectorAll('.wishlist-select-cb:checked');
const selectedTrackIds = new Set(Array.from(checkedBoxes).map(cb => cb.dataset.trackId).filter(Boolean));
closeWishlistOverviewModal();
await openDownloadMissingWishlistModal(category);
await openDownloadMissingWishlistModal(category, selectedTrackIds.size > 0 ? selectedTrackIds : null);
}
async function openDownloadMissingWishlistModal(category = null) {
async function openDownloadMissingWishlistModal(category = null, selectedTrackIds = null) {
showLoadingOverlay('Loading wishlist...');
const playlistId = "wishlist"; // Use a consistent ID for wishlist
@ -13090,6 +13094,12 @@ async function openDownloadMissingWishlistModal(category = null) {
const tracksData = await tracksResponse.json();
tracks = tracksData.tracks || [];
// Filter to only selected tracks if user made a selection
if (selectedTrackIds && selectedTrackIds.size > 0) {
tracks = tracks.filter(t => selectedTrackIds.has(t.id) || selectedTrackIds.has(t.spotify_track_id));
console.log(`📥 Filtered to ${tracks.length} selected tracks (from ${tracksData.tracks?.length || 0} total)`);
}
} catch (error) {
showToast(`Failed to fetch wishlist data: ${error.message}`, 'error');
hideLoadingOverlay();