From 2e8df41bb243eb44096abd3a39ef008bf3876c89 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 10 Oct 2023 11:34:39 +0200 Subject: [PATCH 1/2] fix: ecocredit table with ghost credits on first page --- web-marketplace/src/components/organisms/EcocreditsTable.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web-marketplace/src/components/organisms/EcocreditsTable.tsx b/web-marketplace/src/components/organisms/EcocreditsTable.tsx index 2bb99cd3e3..7fe3cc4c38 100644 --- a/web-marketplace/src/components/organisms/EcocreditsTable.tsx +++ b/web-marketplace/src/components/organisms/EcocreditsTable.tsx @@ -37,7 +37,10 @@ export const EcocreditsTable: React.FC< initialPaginationParams, isIgnoreOffset = false, }) => { - if (!credits?.length) { + const hasMorePages = + (initialPaginationParams?.count ?? 0) > + (initialPaginationParams?.rowsPerPage ?? 0); + if (!credits || (!credits?.length && !hasMorePages)) { return ( Date: Mon, 16 Oct 2023 16:47:27 +0200 Subject: [PATCH 2/2] feat: fetch 10 credits by page --- .../pages/Dashboard/MyEcocredits/hooks/useFetchEcocredits.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-marketplace/src/pages/Dashboard/MyEcocredits/hooks/useFetchEcocredits.ts b/web-marketplace/src/pages/Dashboard/MyEcocredits/hooks/useFetchEcocredits.ts index a000161bcf..586bbe8c05 100644 --- a/web-marketplace/src/pages/Dashboard/MyEcocredits/hooks/useFetchEcocredits.ts +++ b/web-marketplace/src/pages/Dashboard/MyEcocredits/hooks/useFetchEcocredits.ts @@ -41,7 +41,7 @@ export const useFetchEcocredits = ({ const [paginationParams, setPaginationParams] = useState({ page: 0, - rowsPerPage: DEFAULT_ROWS_PER_PAGE, + rowsPerPage: 10, offset: 0, }); const { page, rowsPerPage } = paginationParams;