From 4a69507e3eb09e2fc5cc8396d23cd91e752200ad Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Thu, 20 Feb 2025 21:53:16 -0800 Subject: [PATCH] feat(ui): Improve Artist Album pagination - use maximum of albumartist/artist credits for determining pagination - reduce default maxPerPage considerably. This gives values of 36/72/108 at largest size --- ui/src/artist/ArtistShow.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/src/artist/ArtistShow.jsx b/ui/src/artist/ArtistShow.jsx index 180f3a5b2..357a8df81 100644 --- a/ui/src/artist/ArtistShow.jsx +++ b/ui/src/artist/ArtistShow.jsx @@ -56,11 +56,16 @@ const AlbumShowLayout = (props) => { const { width } = props const [, perPageOptions] = useAlbumsPerPage(width) - const maxPerPage = 90 + const maxPerPage = 36 let perPage = 0 let pagination = null - if (record?.stats?.['artist']?.albumCount > maxPerPage) { + const count = Math.max( + record?.stats?.['albumartist']?.albumCount || 0, + record?.stats?.['artist']?.albumCount ?? 0, + ) + + if (count > maxPerPage) { perPage = Math.trunc(maxPerPage / perPageOptions[0]) * perPageOptions[0] const rowsPerPageOptions = [1, 2, 3].map((option) => option * perPage) pagination =