We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22cc6cd commit c6f04a8Copy full SHA for c6f04a8
src/apps/admin/src/lib/components/common/Pagination/Pagination.tsx
@@ -52,10 +52,10 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => {
52
const pages = []
53
for (
54
let i = props.page - MAX_PAGE_DISPLAY + 1;
55
- i <= props.page;
+ i <= props.page + MAX_PAGE_DISPLAY;
56
i++
57
) {
58
- if (i >= 1) {
+ if (i >= 1 && i <= props.totalPages && pages.length < MAX_PAGE_DISPLAY) {
59
pages.push(i)
60
}
61
@@ -95,7 +95,7 @@ const Pagination: FC<PaginationProps> = (props: PaginationProps) => {
95
96
return [...oldDisplayPages]
97
})
98
- }, [props.page])
+ }, [props.page, props.totalPages])
99
100
useEffect(() => {
101
createDisplayPages()
0 commit comments