Remove action related to infinite scroll from reducer

pull/1137/head
fvictorio 6 years ago committed by Felipe Renan
parent 0f245e1474
commit c79c0f770c
  1. 25
      apps/block_scout_web/assets/__tests__/pages/address.js
  2. 10
      apps/block_scout_web/assets/js/pages/address.js

@ -203,28 +203,3 @@ describe('RECEIVED_NEW_TRANSACTION', () => {
expect(output.transactions).toEqual([]) expect(output.transactions).toEqual([])
}) })
}) })
describe('RECEIVED_NEXT_PAGE', () => {
test('with new transaction page', () => {
const state = Object.assign({}, initialState, {
loadingNextPage: true,
nextPageUrl: '1',
transactions: [{ transactionHash: 1, transactionHtml: 'test 1' }]
})
const action = {
type: 'RECEIVED_NEXT_PAGE',
msg: {
nextPageUrl: '2',
transactions: [{ transactionHash: 2, transactionHtml: 'test 2' }]
}
}
const output = reducer(state, action)
expect(output.loadingNextPage).toEqual(false)
expect(output.nextPageUrl).toEqual('2')
expect(output.transactions).toEqual([
{ transactionHash: 1, transactionHtml: 'test 1' },
{ transactionHash: 2, transactionHtml: 'test 2' }
])
})
})

@ -29,7 +29,7 @@ export const initialState = {
beyondPageOne: null beyondPageOne: null
} }
function reducer (state = initialState, action) { export function reducer (state = initialState, action) {
switch (action.type) { switch (action.type) {
case 'PAGE_LOAD': case 'PAGE_LOAD':
case 'ELEMENTS_LOAD': { case 'ELEMENTS_LOAD': {
@ -99,14 +99,6 @@ function reducer (state = initialState, action) {
balance: action.msg.balance balance: action.msg.balance
}) })
} }
case 'RECEIVED_NEXT_PAGE': {
return Object.assign({}, state, {
transactions: [
...state.transactions,
...action.msg.transactions
]
})
}
default: default:
return state return state
} }

Loading…
Cancel
Save