Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix(ui): update transaction on stream update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed May 10, 2020
1 parent 9cc1999 commit 4a10e8e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions renderer/reducers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,15 @@ export const transactionFailed = ({ internalId, error }) => async (dispatch, get
* @returns {Function} Thunk
*/
export const receiveTransactionData = transaction => (dispatch, getState) => {
// add the transaction only if we are not already aware of it
// add the transaction if we are not already aware of it, otherwise update existing transaction.
const state = getState()
if (
!state.transaction ||
!state.transaction.transactions ||
!state.transaction.transactions.find(tx => tx.txHash === transaction.txHash)
) {
const intl = getIntl()

if (state.transaction.transactions.find(tx => tx.txHash === transaction.txHash)) {
dispatch(receiveTransactions([transaction], true))
} else {
dispatch({ type: ADD_TRANSACTION, transaction })

// fetch updated channels
dispatch(fetchChannels())
const intl = getIntl()
// HTML 5 desktop notification for the new transaction
if (CoinBig(transaction.amount).gt(0)) {
showSystemNotification(intl.formatMessage(messages.transaction_received_title), {
Expand All @@ -260,6 +257,9 @@ export const receiveTransactionData = transaction => (dispatch, getState) => {
})
}
}

// fetch updated channels
dispatch(fetchChannels())
}

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

0 comments on commit 4a10e8e

Please sign in to comment.