mirror of
https://github.com/stashapp/stash.git
synced 2026-02-16 12:22:18 +01:00
Clamp page to max pages (#1403)
This commit is contained in:
parent
81058a7807
commit
0f579076b6
1 changed files with 8 additions and 2 deletions
|
|
@ -175,6 +175,14 @@ const RenderList = <
|
|||
const result = useData(filter);
|
||||
const totalCount = getCount(result);
|
||||
const items = getData(result);
|
||||
const pages = Math.ceil(totalCount / filter.itemsPerPage);
|
||||
|
||||
// handle case where page is more than there are pages
|
||||
useEffect(() => {
|
||||
if (pages > 0 && filter.currentPage > pages) {
|
||||
onChangePage(pages);
|
||||
}
|
||||
}, [pages, filter.currentPage, onChangePage]);
|
||||
|
||||
useEffect(() => {
|
||||
Mousetrap.bind("right", () => {
|
||||
|
|
@ -364,8 +372,6 @@ const RenderList = <
|
|||
return;
|
||||
}
|
||||
|
||||
const pages = Math.ceil(totalCount / filter.itemsPerPage);
|
||||
|
||||
return (
|
||||
<>
|
||||
{renderPagination()}
|
||||
|
|
|
|||
Loading…
Reference in a new issue