@@ -77,17 +77,11 @@ export async function RoutesData(props: {
7777
7878 const totalPages = Math . ceil ( filteredCount / DEFAULT_PAGE_SIZE ) ;
7979
80- const activePage = Number ( props . searchParams . page || 1 ) ;
81- const pageSize = DEFAULT_PAGE_SIZE ;
82- const startIndex = ( activePage - 1 ) * pageSize ;
83- const endIndex = startIndex + pageSize ;
84- const paginatedRoutes = routesToRender . slice ( startIndex , endIndex ) ;
85-
8680 return (
8781 < >
8882 < main >
8983 { /* empty state */ }
90- { paginatedRoutes . length === 0 ? (
84+ { routesToRender . length === 0 ? (
9185 < div className = "flex h-[300px] items-center justify-center rounded-lg border p-8 lg:h-[500px]" >
9286 < p className = "text-2xl" > No Results found</ p >
9387 </ div >
@@ -111,7 +105,7 @@ export async function RoutesData(props: {
111105 </ TableRow >
112106 </ TableHeader >
113107 < TableBody >
114- { paginatedRoutes . map ( ( route ) => (
108+ { routesToRender . map ( ( route ) => (
115109 < RouteListRow
116110 key = { `${ route . originToken . chainId } :${ route . originToken . address } -${ route . destinationToken . chainId } :${ route . destinationToken . address } ` }
117111 originChainId = { route . originToken . chainId }
@@ -131,7 +125,7 @@ export async function RoutesData(props: {
131125 </ TableContainer >
132126 ) : (
133127 < ul className = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" >
134- { paginatedRoutes . map ( ( route ) => (
128+ { routesToRender . map ( ( route ) => (
135129 < li
136130 key = { `${ route . originToken . chainId } :${ route . originToken . address } -${ route . destinationToken . chainId } :${ route . destinationToken . address } ` }
137131 className = "h-full"
@@ -155,12 +149,15 @@ export async function RoutesData(props: {
155149 </ main >
156150 < div className = "h-10" />
157151 { totalPages > 1 && (
158- < ChainlistPagination totalPages = { totalPages } activePage = { activePage } />
152+ < ChainlistPagination
153+ totalPages = { totalPages }
154+ activePage = { Number ( props . searchParams . page ) || 1 }
155+ />
159156 ) }
160157 < div className = "h-4" />
161158 < p className = "text-balance text-center text-muted-foreground text-sm" >
162159 Showing{ " " }
163- < span className = "text-accent-foreground" > { paginatedRoutes . length } </ span > { " " }
160+ < span className = "text-accent-foreground" > { routesToRender . length } </ span > { " " }
164161 out of{ " " }
165162 { filteredCount !== totalCount ? (
166163 < >
0 commit comments