diff --git a/frontend/src/pages/artist.rs b/frontend/src/pages/artist.rs index c016132..e1f9493 100644 --- a/frontend/src/pages/artist.rs +++ b/frontend/src/pages/artist.rs @@ -23,8 +23,9 @@ pub fn artist_page(props: &Props) -> Html { let top_songs_limit = use_state(|| 25usize); let watch_top_count = use_state(|| 10usize); // Track top song status overrides — use Rc so async callbacks always see latest state - let top_song_overrides: Rc>>> = - use_mut_ref(std::collections::HashMap::new); + let top_song_overrides: Rc< + std::cell::RefCell>>, + > = use_mut_ref(std::collections::HashMap::new); // Counter to force re-renders when overrides change let overrides_version = use_state(|| 0u32); let id = props.id.clone(); @@ -336,7 +337,9 @@ pub fn artist_page(props: &Props) -> Html { // Mark all as pending immediately for (i, _, _) in &to_watch { - overrides.borrow_mut().insert(*i, Some("pending".to_string())); + overrides + .borrow_mut() + .insert(*i, Some("pending".to_string())); } version.set(*version + 1); @@ -346,7 +349,13 @@ pub fn artist_page(props: &Props) -> Html { let artist = artist.clone(); wasm_bindgen_futures::spawn_local(async move { for (i, name, mbid) in to_watch { - let status = match api::watch_track(Some(&artist), &name, mbid.as_deref().unwrap_or("")).await { + let status = match api::watch_track( + Some(&artist), + &name, + mbid.as_deref().unwrap_or(""), + ) + .await + { Ok(resp) => resp.status, Err(_) => "wanted".to_string(), }; diff --git a/frontend/src/pages/playlists.rs b/frontend/src/pages/playlists.rs index 42f0eb1..ecca670 100644 --- a/frontend/src/pages/playlists.rs +++ b/frontend/src/pages/playlists.rs @@ -348,7 +348,7 @@ pub fn playlists_page() -> Html { current.is_none() }) .filter(|a| !seeds_c.contains(&a.name)) - .take(15) + .take(50) .cloned() .collect(); html! { @@ -385,7 +385,7 @@ pub fn playlists_page() -> Html { let name = a.name.clone(); let seeds = seeds.clone(); let si = seed_input.clone(); - let track_count = a.total_items; + let track_count = a.local_tracks; html! {
>() .len(); + let local_tracks = queries::tracks::count_by_artist(state.db.conn(), a.id) + .await + .unwrap_or(0); + items.push(ArtistListItem { id: a.id, name: a.name.clone(), @@ -140,6 +145,7 @@ async fn list_artists( total_watched, total_owned, total_items, + local_tracks, }); }