Fix merge conflict in address.js

Co-authored-by: Stamates <stamates@hotmail.com>
pull/949/head
jimmay5469 6 years ago committed by Stamates
parent c301181a49
commit ffaf4ec5bf
  1. 6
      apps/block_scout_web/assets/__tests__/pages/address.js
  2. 14
      apps/block_scout_web/assets/js/pages/address.js

@ -163,7 +163,7 @@ describe('RECEIVED_NEW_TRANSACTION', () => {
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([{ transactionHtml: 'test' }]) expect(output.newTransactions).toEqual([{ transactionHtml: 'test' }])
expect(output.transactionCount).toEqual(1) expect(output.transactionCount).toEqual(null)
}) })
test('single transaction after single transaction', () => { test('single transaction after single transaction', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
@ -211,7 +211,7 @@ describe('RECEIVED_NEW_TRANSACTION', () => {
const output = reducer(state, action) const output = reducer(state, action)
expect(output.newTransactions).toEqual([]) expect(output.newTransactions).toEqual([])
expect(output.transactionCount).toEqual(2) expect(output.transactionCount).toEqual(1)
}) })
test('transaction from current address with "from" filter', () => { test('transaction from current address with "from" filter', () => {
const state = Object.assign({}, initialState, { const state = Object.assign({}, initialState, {
@ -295,6 +295,6 @@ describe('RECEIVED_NEW_TRANSACTION', () => {
expect(output.newTransactions).toEqual([ expect(output.newTransactions).toEqual([
{ transactionHash: '0x00', transactionHtml: 'test' } { transactionHash: '0x00', transactionHtml: 'test' }
]) ])
expect(output.transactionCount).toEqual(1) expect(output.transactionCount).toEqual(null)
}) })
}) })

@ -11,18 +11,6 @@ import { loadTokenBalanceDropdown } from '../lib/token_balance_dropdown'
const BATCH_THRESHOLD = 10 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 = { export const initialState = {
addressHash: null, addressHash: null,
balance: null, balance: null,
@ -115,7 +103,7 @@ export function reducer (state = initialState, action) {
case 'RECEIVED_NEW_TRANSACTION': { case 'RECEIVED_NEW_TRANSACTION': {
if (state.channelDisconnected) return state 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 || if (state.beyondPageOne ||
(state.filter === 'to' && action.msg.toAddressHash !== state.addressHash) || (state.filter === 'to' && action.msg.toAddressHash !== state.addressHash) ||

Loading…
Cancel
Save