diff --git a/apps/block_scout_web/assets/__tests__/pages/address.js b/apps/block_scout_web/assets/__tests__/pages/address.js index 77f10fb938..7691660a40 100644 --- a/apps/block_scout_web/assets/__tests__/pages/address.js +++ b/apps/block_scout_web/assets/__tests__/pages/address.js @@ -163,7 +163,7 @@ describe('RECEIVED_NEW_TRANSACTION', () => { const output = reducer(state, action) expect(output.newTransactions).toEqual([{ transactionHtml: 'test' }]) - expect(output.transactionCount).toEqual(1) + expect(output.transactionCount).toEqual(null) }) test('single transaction after single transaction', () => { const state = Object.assign({}, initialState, { @@ -211,7 +211,7 @@ describe('RECEIVED_NEW_TRANSACTION', () => { const output = reducer(state, action) expect(output.newTransactions).toEqual([]) - expect(output.transactionCount).toEqual(2) + expect(output.transactionCount).toEqual(1) }) test('transaction from current address with "from" filter', () => { const state = Object.assign({}, initialState, { @@ -295,6 +295,6 @@ describe('RECEIVED_NEW_TRANSACTION', () => { expect(output.newTransactions).toEqual([ { transactionHash: '0x00', transactionHtml: 'test' } ]) - expect(output.transactionCount).toEqual(1) + expect(output.transactionCount).toEqual(null) }) }) diff --git a/apps/block_scout_web/assets/js/pages/address.js b/apps/block_scout_web/assets/js/pages/address.js index 74301a1643..c3ed5a9ba7 100644 --- a/apps/block_scout_web/assets/js/pages/address.js +++ b/apps/block_scout_web/assets/js/pages/address.js @@ -11,18 +11,6 @@ import { loadTokenBalanceDropdown } from '../lib/token_balance_dropdown' const BATCH_THRESHOLD = 10 -const incrementTransactionsCount = (transactions, addressHash, currentValue) => { - const reducer = (accumulator, {fromAddressHash}) => { - if (fromAddressHash === addressHash) { - accumulator++ - } - - return accumulator - } - - return transactions.reduce(reducer, currentValue) -} - export const initialState = { addressHash: null, balance: null, @@ -115,7 +103,7 @@ export function reducer (state = initialState, action) { case 'RECEIVED_NEW_TRANSACTION': { if (state.channelDisconnected) return state - const transactionCount = state.transactionCount + 1 + const transactionCount = (action.msg.fromAddressHash === state.addressHash) ? state.transactionCount + 1 : state.transactionCount if (state.beyondPageOne || (state.filter === 'to' && action.msg.toAddressHash !== state.addressHash) ||