Attempt to fix playlist gen dropdown

This commit is contained in:
Connor Johnstone
2026-03-26 13:20:20 -04:00
parent 4ccc6bcf27
commit 5786cc89e5
4 changed files with 23 additions and 6 deletions
+13 -4
View File
@@ -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<RefCell> so async callbacks always see latest state
let top_song_overrides: Rc<std::cell::RefCell<std::collections::HashMap<usize, Option<String>>>> =
use_mut_ref(std::collections::HashMap::new);
let top_song_overrides: Rc<
std::cell::RefCell<std::collections::HashMap<usize, Option<String>>>,
> = 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(),
};
+2 -2
View File
@@ -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! {
<div class="autocomplete-item" onclick={Callback::from(move |_: MouseEvent| {
let mut v = (*seeds).clone();
+2
View File
@@ -35,6 +35,8 @@ pub struct ArtistListItem {
pub total_watched: usize,
pub total_owned: usize,
pub total_items: usize,
#[serde(default)]
pub local_tracks: u64,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]