mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Clamp page to max pages (#1403)
This commit is contained in:
@@ -175,6 +175,14 @@ const RenderList = <
|
|||||||
const result = useData(filter);
|
const result = useData(filter);
|
||||||
const totalCount = getCount(result);
|
const totalCount = getCount(result);
|
||||||
const items = getData(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(() => {
|
useEffect(() => {
|
||||||
Mousetrap.bind("right", () => {
|
Mousetrap.bind("right", () => {
|
||||||
@@ -364,8 +372,6 @@ const RenderList = <
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pages = Math.ceil(totalCount / filter.itemsPerPage);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{renderPagination()}
|
{renderPagination()}
|
||||||
|
|||||||
Reference in New Issue
Block a user