diff --git a/src/renderer/features/albums/components/album-list-content.tsx b/src/renderer/features/albums/components/album-list-content.tsx index c0a74362..7a494f7a 100644 --- a/src/renderer/features/albums/components/album-list-content.tsx +++ b/src/renderer/features/albums/components/album-list-content.tsx @@ -131,9 +131,13 @@ export const AlbumListContent = ({ (event: PaginationChangedEvent) => { if (!isPaginationEnabled || !event.api) return; - // Scroll to top of page on pagination change - const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; - event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + try { + // Scroll to top of page on pagination change + const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; + event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + } catch (err) { + console.log(err); + } setPagination({ itemsPerPage: event.api.paginationGetPageSize(), diff --git a/src/renderer/features/artists/components/album-artist-list-content.tsx b/src/renderer/features/artists/components/album-artist-list-content.tsx index 95ef5b93..8cd1ea3b 100644 --- a/src/renderer/features/artists/components/album-artist-list-content.tsx +++ b/src/renderer/features/artists/components/album-artist-list-content.tsx @@ -124,9 +124,13 @@ export const AlbumArtistListContent = ({ gridRef, tableRef }: AlbumArtistListCon (event: PaginationChangedEvent) => { if (!isPaginationEnabled || !event.api) return; - // Scroll to top of page on pagination change - const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; - event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + try { + // Scroll to top of page on pagination change + const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; + event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + } catch (err) { + console.log(err); + } setPagination({ itemsPerPage: event.api.paginationGetPageSize(), diff --git a/src/renderer/features/playlists/components/playlist-list-content.tsx b/src/renderer/features/playlists/components/playlist-list-content.tsx index d879a3ad..197232f2 100644 --- a/src/renderer/features/playlists/components/playlist-list-content.tsx +++ b/src/renderer/features/playlists/components/playlist-list-content.tsx @@ -107,9 +107,13 @@ export const PlaylistListContent = ({ tableRef, itemCount }: PlaylistListContent (event: PaginationChangedEvent) => { if (!isPaginationEnabled || !event.api) return; - // Scroll to top of page on pagination change - const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; - event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + try { + // Scroll to top of page on pagination change + const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; + event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + } catch (err) { + console.log(err); + } setPagination({ itemsPerPage: event.api.paginationGetPageSize(), diff --git a/src/renderer/features/songs/components/song-list-content.tsx b/src/renderer/features/songs/components/song-list-content.tsx index 71c46ae0..15fb04c3 100644 --- a/src/renderer/features/songs/components/song-list-content.tsx +++ b/src/renderer/features/songs/components/song-list-content.tsx @@ -104,10 +104,13 @@ export const SongListContent = ({ customFilters, itemCount, tableRef }: SongList (event: PaginationChangedEvent) => { if (!isPaginationEnabled || !event.api) return; - // Scroll to top of page on pagination change - const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; - event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); - + try { + // Scroll to top of page on pagination change + const currentPageStartIndex = pagination.currentPage * pagination.itemsPerPage; + event.api?.ensureIndexVisible(currentPageStartIndex, 'top'); + } catch (err) { + console.log(err); + } setPagination({ itemsPerPage: event.api.paginationGetPageSize(), totalItems: event.api.paginationGetRowCount(),