From 56e39307bb5b67591fd41c754ca2661a39ec6983 Mon Sep 17 00:00:00 2001 From: dragosp1011 Date: Fri, 25 Oct 2024 22:57:25 +0200 Subject: [PATCH] fix: check new transactions length --- packages/wallet/backend/src/transaction/service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/wallet/backend/src/transaction/service.ts b/packages/wallet/backend/src/transaction/service.ts index 41d705848..9ad92125b 100644 --- a/packages/wallet/backend/src/transaction/service.ts +++ b/packages/wallet/backend/src/transaction/service.ts @@ -141,18 +141,20 @@ export class TransactionService implements ITransactionService { page ) - if (transactionsResponse.data.length === 0) { - return - } - const newTransactions = transactionsResponse.data.filter( (transaction) => !latestTransaction || latestTransaction.createdAt.toISOString() <= transaction.createdAt ) + + if (newTransactions.length === 0) { + return + } + if (transactionsResponse.data.length > newTransactions.length) { shouldFetchNext = false } + page++ const transactionsToSave: Partial[] = newTransactions.map(