From b35c730dc92681c14fc5178dc906355268fd600c Mon Sep 17 00:00:00 2001 From: JeanneGrenet Date: Thu, 5 Sep 2024 14:09:19 +0100 Subject: [PATCH] fix : put condition on firstItemOnPage pagination props --- src/components/Pagination/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Pagination/index.tsx b/src/components/Pagination/index.tsx index 30f31f597..39eafbc89 100644 --- a/src/components/Pagination/index.tsx +++ b/src/components/Pagination/index.tsx @@ -24,7 +24,7 @@ export const getPaginationInfo = ({ pageSize = 10, totalItems = 0, }) => { - const firstItemOnPage = (page - 1) * pageSize + 1; + const firstItemOnPage = totalItems > 0 ? (page - 1) * pageSize + 1 : 0; const lastItemOnPage = Math.min( (page - 1) * pageSize + pageSize, totalItems ?? 0