discover: fix decade/LB tracks showing Unknown — normalizer must fall back to the track itself

_normalizeTrack fell back to {} when there was no track_data_json, so it never read the top-level
name/artists[]/album that decade (and Spotify-shaped) rows carry — every field defaulted to Unknown.
Fall back to the track object itself (|| track), matching _renderTabbedTrackLists trackData = track
behaviour. Flat (track_name) + nested (track_data_json) shapes still resolve.
This commit is contained in:
BoulderBadgeDad 2026-06-29 15:39:09 -07:00
parent 391fc9ae78
commit a236974e43

View file

@ -4398,7 +4398,9 @@ async function loadPersonalizedDailyMixes() {
// personalized mixes, or nested under track_data_json (name/artists[]/album/…) for the decade,
// ListenBrainz + Last.fm playlists. Normalize both so renderers don't print "undefined". #discover
function _normalizeTrack(track) {
const td = (track && track.track_data_json) || {};
// track_data_json when present, else the track itself (decade/Spotify-shaped rows carry
// name/artists[]/album at the top level — same fallback _renderTabbedTrackList uses).
const td = (track && track.track_data_json) || track || {};
const a0 = td.artists && td.artists[0];
return {
name: td.name || td.track_name || track.track_name || 'Unknown Track',