From dbb459a3a5865a01e0df856459da5c487c6cb37e Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 11 Apr 2026 00:58:26 -0300 Subject: [PATCH] feat: enhance pagination by allowing dynamic page size in article listing --- src/app/(pages)/home/page.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/(pages)/home/page.tsx b/src/app/(pages)/home/page.tsx index 7e86613..eddb651 100644 --- a/src/app/(pages)/home/page.tsx +++ b/src/app/(pages)/home/page.tsx @@ -5,19 +5,20 @@ import { FileTextIcon } from 'lucide-react'; const PAGE_SIZE = 9; -interface HomeProps { - searchParams: Promise<{ page?: string }>; -} +type HomeProps = { + searchParams: Promise<{ page?: string; pageSize?: string }>; +}; const Home = async ({ searchParams }: HomeProps) => { - const { page: pageParam } = await searchParams; + const { page: pageParam, pageSize: pageSizeParam } = await searchParams; const page = Math.max(1, Number(pageParam) || 1); + const pageSize = Number(pageSizeParam) || PAGE_SIZE; const { data: articles, totalPages, total, - } = await getArticlesPaginated(page, PAGE_SIZE); + } = await getArticlesPaginated(page, pageSize); return (