Skip to content

Commit

Permalink
fix: new page when query returns 0 items
Browse files Browse the repository at this point in the history
  • Loading branch information
Komoszek committed Nov 14, 2023
1 parent 8c7f27f commit b880057
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/api-admin/src/lib/hooks/usePagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function usePagination({
if (paginationRef.current) paginationRef.current.total = total;

if (total !== undefined) {
const totalPages = Math.ceil(total / pageSize);
const totalPages = Math.max(Math.ceil(total / pageSize), 1);

if (totalPages < displayPage) {
setDisplayPage(totalPages);
Expand Down

0 comments on commit b880057

Please sign in to comment.