Skip to content

Commit

Permalink
fix: check new transactions length (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragosp1011 authored Oct 25, 2024
1 parent ac6b84b commit 36a6c42
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/wallet/backend/src/transaction/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Transaction>[] = newTransactions.map(
Expand Down

0 comments on commit 36a6c42

Please sign in to comment.