From c21f3be6968a76e2af2907f33e6715a4120203ad Mon Sep 17 00:00:00 2001 From: Honey Date: Thu, 4 Jun 2026 11:06:34 +0200 Subject: [PATCH] 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 --- src/views.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/views.js b/src/views.js index 02a94d6..0cbf3f1 100644 --- a/src/views.js +++ b/src/views.js @@ -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 = `

${e.message}

`; } }