Fix wishlist download status tooltip showing wrong track name (#227)

The tooltip on failed/not_found tracks was offset by 3-6 items because
the backend cleanup step removed owned tracks from the wishlist between
when the frontend rendered the table and when the backend assigned
track indices. Surviving tracks got new enumeration indices (0,1,2...)
that didn't match their original table row positions (0,1,3,4...).

Fix: stamp each track with its position in the frontend's track_ids
array as _original_index, so the track_index always matches the modal
table row regardless of how many tracks were cleaned during processing.
pull/253/head
Broque Thomas 1 month ago
parent 1a0fd8b95e
commit 1fb9b45d59

@ -21614,12 +21614,15 @@ def start_wishlist_missing_downloads():
track_lookup[spotify_track_id] = track
# Iterate in track_ids order (matches frontend display order)
# so that enumerate()-based track_index aligns with data-track-index in the modal
# Stamp each track with its original position in the track_ids array
# so track_index matches the modal row even if cleanup removed some tracks
filtered_tracks = []
seen_track_ids = set()
for tid in track_ids:
for frontend_index, tid in enumerate(track_ids):
if tid in track_lookup and tid not in seen_track_ids:
filtered_tracks.append(track_lookup[tid])
track = track_lookup[tid]
track['_original_index'] = frontend_index # Preserve frontend table position
filtered_tracks.append(track)
seen_track_ids.add(tid)
wishlist_tracks = filtered_tracks

Loading…
Cancel
Save