From 3b0cb2732fb746ecc06241b15854d8ab5692944b Mon Sep 17 00:00:00 2001 From: Jan Komarek Date: Fri, 21 Jun 2024 17:03:56 +0200 Subject: [PATCH] fix(suite-native): add fallback to [] --- .../components/TransactionsList/TransactionList.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/suite-native/transactions/src/components/TransactionsList/TransactionList.tsx b/suite-native/transactions/src/components/TransactionsList/TransactionList.tsx index 67ebfe8554cd..c5ac5006f470 100644 --- a/suite-native/transactions/src/components/TransactionsList/TransactionList.tsx +++ b/suite-native/transactions/src/components/TransactionsList/TransactionList.tsx @@ -168,10 +168,14 @@ export const TransactionList = ({ // TODO: display pending transactions in the correct order const [pendingTxs, confirmedTxs] = arrayPartition(transactions, isPending); const accountTransactionsByMonth = groupTransactionsByDate(confirmedTxs, 'month'); - accountTransactionsByMonth['pending'] = [ - ...accountTransactionsByMonth['no-blocktime'], - ...pendingTxs, - ]; + if (pendingTxs.length || accountTransactionsByMonth['no-blocktime']) { + accountTransactionsByMonth['pending'] = [ + ...(accountTransactionsByMonth['no-blocktime'] ?? []), + ...pendingTxs, + ]; + delete accountTransactionsByMonth['no-blocktime']; + } + const transactionMonthKeys = Object.keys(accountTransactionsByMonth) as MonthKey[]; if (tokenContract) {