From 399acbeccf23f3bb2c91af254235a850f9bb1dd4 Mon Sep 17 00:00:00 2001 From: void-57 Date: Wed, 17 Dec 2025 05:26:55 +0530 Subject: [PATCH] feat: Refine transaction pagination logic --- index.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 254a387..244acf4 100644 --- a/index.html +++ b/index.html @@ -1211,17 +1211,20 @@ next: txNextToken }); - // Check if we got more than ITEMS_PER_PAGE transactions + // Get all fetched transactions const fetchedTransactions = result.transactions || []; - if (fetchedTransactions.length > ITEMS_PER_PAGE) { - - allTransactions = [...allTransactions, ...fetchedTransactions.slice(0, ITEMS_PER_PAGE)]; + // Add all fetched transactions to our array + allTransactions = [...allTransactions, ...fetchedTransactions]; + + // Determine if there are more transactions: + // If we got exactly limit+1 transactions, there might be more + // Also check the API's hasMore flag + if (fetchedTransactions.length === ITEMS_PER_PAGE + 1 && result.hasMore) { hasMoreTransactions = true; txNextToken = result.nextToken; } else { - - allTransactions = [...allTransactions, ...fetchedTransactions]; + hasMoreTransactions = false; txNextToken = null; }