Browse Source
Merge pull request #585 from Empact/fix/transaction-notification
fix(transaction notification): fix that state access was off the mark
renovate/lint-staged-8.x
JimmyMow
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
1 deletions
-
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
|
|
|
// Listener for when a new transaction is pushed from the subscriber
|
|
|
export const newTransaction = (event, { transaction }) => (dispatch, getState) => { |
|
|
export const newTransaction = (event, { transaction }) => (dispatch, getState) => { |
|
|
// add the transaction only if we are not already aware of it
|
|
|
// 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
|
|
|
// Fetch new balance
|
|
|
dispatch(fetchBalance()) |
|
|
dispatch(fetchBalance()) |
|
|
|
|
|
|
|
|