From 2d6be1a22cfdf5bf39adddf7d59590c83322d905 Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Wed, 25 Mar 2026 11:10:44 -0400 Subject: [PATCH] fix to artist unwatch/watch bug --- frontend/src/pages/artist.rs | 8 ++++++-- frontend/src/types.rs | 2 ++ src/routes/artists.rs | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/artist.rs b/frontend/src/pages/artist.rs index e890b7a..29d101c 100644 --- a/frontend/src/pages/artist.rs +++ b/frontend/src/pages/artist.rs @@ -139,9 +139,13 @@ pub fn artist_page(props: &Props) -> Html { } } else { - // Watch All + // Watch All — prefer enrichment MBID over DB record (import may not have set it) let artist_name = d.artist.name.clone(); - let artist_mbid = d.artist.musicbrainz_id.clone(); + let artist_mbid = d + .artist_info + .as_ref() + .and_then(|i| i.mbid.clone()) + .or_else(|| d.artist.musicbrainz_id.clone()); let message = message.clone(); let error = error.clone(); let fetch = fetch.clone(); diff --git a/frontend/src/types.rs b/frontend/src/types.rs index 26df87c..295f47b 100644 --- a/frontend/src/types.rs +++ b/frontend/src/types.rs @@ -83,6 +83,8 @@ pub struct FullArtistDetail { pub struct ArtistInfoFe { pub name: String, #[serde(default)] + pub mbid: Option, + #[serde(default)] pub disambiguation: Option, #[serde(default)] pub country: Option, diff --git a/src/routes/artists.rs b/src/routes/artists.rs index 67ea5ef..8e71108 100644 --- a/src/routes/artists.rs +++ b/src/routes/artists.rs @@ -349,6 +349,11 @@ pub async fn enrich_artist( } }; + // Backfill artist MBID if the DB record doesn't have one yet (e.g., from import) + if artist.musicbrainz_id.is_none() && id.is_some() { + let _ = queries::artists::upsert(state.db.conn(), &artist.name, Some(&mbid)).await; + } + // Fetch artist photo + bio + banner (cached, provider-aware) let config = state.config.read().await; let image_source = config.metadata.artist_image_source.clone();