From c7a921fa46a26002b8b3cef038be68ca7644c11d Mon Sep 17 00:00:00 2001 From: samepant Date: Sat, 20 Jan 2024 00:26:20 -0500 Subject: [PATCH] fix pagination bug --- frontend/src/components/Layout/Layout.module.css | 2 +- frontend/src/components/NFTGrid/index.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Layout/Layout.module.css b/frontend/src/components/Layout/Layout.module.css index ab5be5b..ffbd841 100644 --- a/frontend/src/components/Layout/Layout.module.css +++ b/frontend/src/components/Layout/Layout.module.css @@ -49,7 +49,7 @@ display: flex; flex-direction: column; align-items: center; - margin: 100px 0; + margin: 150px 0 50px; position: relative; z-index: 10; padding: 0 20px; diff --git a/frontend/src/components/NFTGrid/index.tsx b/frontend/src/components/NFTGrid/index.tsx index a85ae03..eb19f98 100644 --- a/frontend/src/components/NFTGrid/index.tsx +++ b/frontend/src/components/NFTGrid/index.tsx @@ -66,7 +66,10 @@ export const CollectionNftGrid: React.FC = ({ address }) => { const nftBalances = (currentPage?.result as MoralisNFT[]) || ([] as MoralisNFT[]) - const previousPageAvailable = (data?.pageParams[0] as string[]).length > 0 + const previousPageAvailable = + data && + data.pageParams.length > 0 && + (data.pageParams[0] as string[]).length > 0 const nextPageAvailable = currentPage?.cursor && currentPage.cursor.length > 0 const deployedMechs = useDeployedMechs(getNFTContexts(nftBalances), chainId)