How to empty data and merge new data in redux

the new data needs to be populated due to scrolling loading, but the data needs to be left empty to fill the new data when filtering.

const initState = fromJS({
  total: 1,
  listData: []
})
const loadData = (state, action) => {
  if (action.bool) {
    return state.merge({
      "listData": action.payload,
      "total": action.total,
    })
  } else {
    return state.merge({
      "listData": state.get("listData").concat(action.payload),
      "total": action.total,
    })
  }
};
export default (state = initState, action) => {
  switch(action.type){
    case constants.LOAD_DATA:
      return loadData(state, action)
    default:
      return state
    }
}

if you look at
in the radux browser plug-in, everything is fine

clipboard.png

clipboard.png
what is this problem, and how do I need to solve

Jul.03,2021

initState uses ImmutableJS , so just use it again

in mapStateToProps :
import {toJS} from 'immutable'

return {
    listData: state.listData.toJS()
}
Menu