fix: fetch real playlist song counts from getPlaylist in background
getPlaylists returns stale/wrong songCount from Navidrome's index. After rendering the grid, fire one getPlaylist request per playlist in parallel and update each card's subtitle as responses arrive. Counts are visually corrected within a second of the page loading. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d5f4a620d
commit
c21f3be696
1 file changed
+8
@@ -692,6 +692,14 @@ export async function loadPlaylists() {
|
||||
c.querySelector('.card-info').onclick = () => navigate('playlist-detail', pl);
|
||||
g.appendChild(c);
|
||||
});
|
||||
// Navidrome's getPlaylists songCount is often stale — fetch each real count in the background.
|
||||
lists.forEach(pl => {
|
||||
api('getPlaylist', `&id=${pl.id}`).then(r => {
|
||||
const count = (r.playlist?.entry || []).length;
|
||||
const card = g.querySelector(`[data-pl-id="${pl.id}"]`);
|
||||
if (card) card.querySelector('.card-sub').textContent = count + ' Titel';
|
||||
}).catch(() => {});
|
||||
});
|
||||
} catch(e) { g.innerHTML = `<p style="color:var(--danger)">${e.message}</p>`; }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user