Browse Source

fix(transaction notification): fix that state access was off the mark

And make the test more robust against unexpected state.
renovate/lint-staged-8.x
Ben Woosley 7 years ago
parent
commit
bfd13835f8
No known key found for this signature in database GPG Key ID: 6EE5F3785F78B345
  1. 7
      app/reducers/transaction.js

7
app/reducers/transaction.js

@ -123,7 +123,12 @@ export const transactionError = (event, { error }) => dispatch => {
// Listener for when a new transaction is pushed from the subscriber
export const newTransaction = (event, { transaction }) => (dispatch, getState) => {
// add the transaction only if we are not already aware of it
if (!getState().transactions.find(tx => tx.tx_hash === transaction.tx_hash)) {
const state = getState()
if (
!state.transaction ||
!state.transaction.transactions ||
!state.transaction.transactions.find(tx => tx.tx_hash === transaction.tx_hash)
) {
// Fetch new balance
dispatch(fetchBalance())

Loading…
Cancel
Save