Skip to content

Commit

Permalink
Merge pull request LN-Zap#336 from Empact/fix/transaction-repetition
Browse files Browse the repository at this point in the history
Only ADD_TRANSACTION if we are not already tracking the transaction
  • Loading branch information
Empact authored Mar 16, 2018
2 parents 789b73c + 2ade0a7 commit d511b65
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/reducers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ const ACTION_HANDLERS = {
[RECEIVE_TRANSACTIONS]: (state, { transactions }) => ({ ...state, transactionLoading: false, transactions }),
[TRANSACTION_SUCCESSFULL]: state => ({ ...state, sendingTransaction: false }),
[TRANSACTION_FAILED]: state => ({ ...state, sendingTransaction: false }),
[ADD_TRANSACTION]: (state, { transaction }) => ({ ...state, transactions: [transaction, ...state.transactions] })
[ADD_TRANSACTION]: (state, { transaction }) => (
// add the transaction only if we are not already aware of it
state.transactions.find(tx => (tx.tx_hash === transaction.tx_hash)) ? state : {
...state,
transactions: [transaction, ...state.transactions]
}
)
}

// ------------------------------------
Expand Down

0 comments on commit d511b65

Please sign in to comment.