Fix track counter fallback to use filtered albums instead of total stats

Changed the fallback case (Tracks view without search) to calculate from
filtered albums instead of using stats.track_count.

Now when both filters are active (network folders + downloads hidden):
- Shows 0 tracks correctly instead of total count
- Counter always reflects actual filtered content across all tabs
This commit is contained in:
vicrodh committed 2026-01-20 01:54:27 -06:00
1 parent 225455bd50
commit 5b0fb1a72d
1 file changed
+3 -2
@@ -197,8 +197,9 @@
if (activeTab === 'artists') {
return artists.reduce((sum, artist) => sum + artist.track_count, 0);
}
// Fallback for tracks view when no search results
return stats ? stats.track_count : 0;
// Fallback for tracks view when no search results - calculate from albums
// This ensures the counter respects filters even when tracks aren't loaded
return albums.reduce((sum, album) => sum + album.track_count, 0);
});
// Loading state