From afa1f92d3d91aef97b1ff6f54d8e036e8a1d9492 Mon Sep 17 00:00:00 2001 From: nicosampler Date: Wed, 27 May 2020 13:17:11 -0300 Subject: [PATCH 1/2] Fix app crashing when safeTransactions is undefined --- src/logic/safe/transactions/awaitingTransactions.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/logic/safe/transactions/awaitingTransactions.ts b/src/logic/safe/transactions/awaitingTransactions.ts index 25d3f3ae..f1a9ef55 100644 --- a/src/logic/safe/transactions/awaitingTransactions.ts +++ b/src/logic/safe/transactions/awaitingTransactions.ts @@ -6,6 +6,10 @@ export const getAwaitingTransactions = (allTransactions, cancellationTransaction } const allAwaitingTransactions = allTransactions.map((safeTransactions) => { + if (!safeTransactions) { + return [] + } + const nonCancelledTransactions = safeTransactions.filter((transaction) => { // If transactions are not executed, but there's a transaction with the same nonce EXECUTED later // it means that the transaction was cancelled (Replaced) and shouldn't get executed From 7a79579238cf67fce049cf744432e173819b105b Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Thu, 28 May 2020 12:03:21 -0300 Subject: [PATCH 2/2] Revert initial fix Add default transaction value for safes without outgoing transactions --- src/logic/safe/transactions/awaitingTransactions.ts | 4 ---- src/routes/safe/store/actions/fetchTransactions.ts | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/logic/safe/transactions/awaitingTransactions.ts b/src/logic/safe/transactions/awaitingTransactions.ts index f1a9ef55..25d3f3ae 100644 --- a/src/logic/safe/transactions/awaitingTransactions.ts +++ b/src/logic/safe/transactions/awaitingTransactions.ts @@ -6,10 +6,6 @@ export const getAwaitingTransactions = (allTransactions, cancellationTransaction } const allAwaitingTransactions = allTransactions.map((safeTransactions) => { - if (!safeTransactions) { - return [] - } - const nonCancelledTransactions = safeTransactions.filter((transaction) => { // If transactions are not executed, but there's a transaction with the same nonce EXECUTED later // it means that the transaction was cancelled (Replaced) and shouldn't get executed diff --git a/src/routes/safe/store/actions/fetchTransactions.ts b/src/routes/safe/store/actions/fetchTransactions.ts index 6f1a0879..de647bc0 100644 --- a/src/routes/safe/store/actions/fetchTransactions.ts +++ b/src/routes/safe/store/actions/fetchTransactions.ts @@ -262,7 +262,7 @@ export const loadSafeTransactions = async (safeAddress, getState) => { const groupedTxs = List(txsRecord).groupBy((tx) => (tx.get('cancellationTx') ? 'cancel' : 'outgoing')) return { - outgoing: groupedTxs.get('outgoing'), + outgoing: groupedTxs.get('outgoing') || List([]), cancel: Map().set(safeAddress, groupedTxs.get('cancel')), } }