From 686dc3e992cf993b68e799c07de27b0db34f6882 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 24 Jun 2025 12:19:47 +0100 Subject: [PATCH] chore: Promise all leftovers from complex selects --- .../lib/new-admin/services/transactions.js | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/packages/server/lib/new-admin/services/transactions.js b/packages/server/lib/new-admin/services/transactions.js index c2b76315..f4222c38 100644 --- a/packages/server/lib/new-admin/services/transactions.js +++ b/packages/server/lib/new-admin/services/transactions.js @@ -36,37 +36,32 @@ function batch({ simplified, }) { const isCsvExport = _.isBoolean(simplified) - return ( - Promise.all([ - getTransactionList( - { - from, - until, - cryptoCode, - txClass, - deviceId, - toAddress, - customerId, - swept, - status, - excludeTestingCustomers, - }, - { limit, offset }, - ), - ]) - // Promise.all(promises) - .then(it => addProfits(it[0])) - .then(res => - !isCsvExport - ? res - : // GQL transactions and transactionsCsv both use this function and - // if we don't check for the correct simplified value, the Transactions page polling - // will continuously build a csv in the background - simplified - ? simplifiedBatch(res) - : advancedBatch(res), - ) + return getTransactionList( + { + from, + until, + cryptoCode, + txClass, + deviceId, + toAddress, + customerId, + swept, + status, + excludeTestingCustomers, + }, + { limit, offset }, ) + .then(addProfits) + .then(res => + !isCsvExport + ? res + : // GQL transactions and transactionsCsv both use this function and + // if we don't check for the correct simplified value, the Transactions page polling + // will continuously build a csv in the background + simplified + ? simplifiedBatch(res) + : advancedBatch(res), + ) } function advancedBatch(data) {