Connect playlist count callback for single source of truth

Wire onPlaylistCountUpdate from PlaylistDetailView to Sidebar's
updatePlaylistCounts method in +page.svelte. This ensures the
sidebar displays accurate track counts from the database instead
of calculated values that could drift out of sync.
This commit is contained in:
vicrodh committed 2026-01-16 07:19:34 -06:00
1 parent 7292635210
commit aeb13b9ffc
6 files changed
+146 -3

No files matched your search

+13
View File
@@ -287,6 +287,19 @@
loadLocalTrackCounts();
}
// Update counts for a specific playlist (single source of truth from detail view)
export function updatePlaylistCounts(playlistId: number, qobuzCount: number, localCount: number) {
// Update Qobuz count in userPlaylists
userPlaylists = userPlaylists.map(p =>
p.id === playlistId ? { ...p, tracks_count: qobuzCount } : p
);
// Update local count
localTrackCounts.set(playlistId, localCount);
localTrackCounts = new Map(localTrackCounts); // Trigger reactivity
// Invalidate tooltip cache for this playlist
invalidatePlaylistTooltip(playlistId);
}
// Menu handling functions
function closeMenu() {
menuOpen = false;