From 32cc7cbd5eb41958065d5eeb1e4f1f1d49f1e3d9 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 4 Apr 2026 23:59:02 -0700 Subject: [PATCH] Fix artist info modal failing on watchlist map nodes with NULL IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Watchlist map nodes used w.get('key', '') which returns None when the DB column is NULL (key exists with None value). None serialized to JSON null, which is falsy in JS, causing 'No source ID' throw for every artist click. - Changed to `w.get('key') or ''` for all ID fields (coerces None→'') - Added discogs_id to watchlist nodes (was missing entirely) - Removed hard throw when no source ID — falls back to name-based lookup - Added console.error logging for future diagnosis --- web_server.py | 13 +++++++------ webui/static/script.js | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/web_server.py b/web_server.py index e60acbfb..2efaa0fe 100644 --- a/web_server.py +++ b/web_server.py @@ -41291,9 +41291,10 @@ def get_artist_map_data(): 'image_url': img, 'type': 'watchlist', 'genres': [], - 'spotify_id': w.get('spotify_artist_id', ''), - 'itunes_id': w.get('itunes_artist_id', ''), - 'deezer_id': w.get('deezer_artist_id', ''), + 'spotify_id': w.get('spotify_artist_id') or '', + 'itunes_id': w.get('itunes_artist_id') or '', + 'deezer_id': w.get('deezer_artist_id') or '', + 'discogs_id': w.get('discogs_artist_id') or '', 'source_db_id': str(w['id']), }) @@ -41333,9 +41334,9 @@ def get_artist_map_data(): 'image_url': img, 'type': 'similar', 'genres': genres, - 'spotify_id': r.get('similar_artist_spotify_id', ''), - 'itunes_id': r.get('similar_artist_itunes_id', ''), - 'deezer_id': r.get('similar_artist_deezer_id', ''), + 'spotify_id': r.get('similar_artist_spotify_id') or '', + 'itunes_id': r.get('similar_artist_itunes_id') or '', + 'deezer_id': r.get('similar_artist_deezer_id') or '', 'rank': r.get('similarity_rank', 5), 'occurrence': r.get('occurrence_count', 1), 'popularity': r.get('popularity', 0), diff --git a/webui/static/script.js b/webui/static/script.js index e104190a..d860c265 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -55225,10 +55225,10 @@ async function openYourArtistInfoModal(poolId) { // Fetch enrichment data (with timeout) try { - if (!artistId) throw new Error('No source ID'); const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 8000); - const resp = await fetch(`/api/discover/your-artists/info/${artistId}?name=${encodeURIComponent(artistName)}`, { signal: controller.signal }); + const lookupId = artistId || encodeURIComponent(artistName); + const resp = await fetch(`/api/discover/your-artists/info/${lookupId}?name=${encodeURIComponent(artistName)}`, { signal: controller.signal }); clearTimeout(timeout); const artist = resp.ok ? await resp.json() : {}; const bodyEl = document.getElementById('ya-info-body'); @@ -55320,6 +55320,7 @@ async function openYourArtistInfoModal(poolId) { `; } } catch (err) { + console.error('[Artist Info] Error loading artist info:', err); const bodyEl = document.getElementById('ya-info-body'); if (bodyEl) bodyEl.innerHTML = `
Could not load artist info
`; }