redux-paginator icon indicating copy to clipboard operation
redux-paginator copied to clipboard

the TODOS_RECEIVED case will never execute since this lib only dispatch RECEIVE_PAGE

Open videni opened this issue 6 years ago • 0 comments

the TODOS_RECEIVED case will never execute since this lib only dispatch RECEIVE_PAGE , so I don't why we need to create add TODOS_RECEIVED case in the example?

const todos = (todos = {}, action = {}) {
  switch (action.type) {
    case 'TODOS_RECEIVED':
      let _todos = {}
      for (let todo of action.results) {
        _todos = {
          ...todos,
          [todo.id]: todo
        }
      }
      return {
        ...todos,
        ..._todos
      }
    default:
      return todosPaginator.itemsReducer(todos, action)
  }
}

export default combineReducers({
  todos,
  pagination: todosPaginator.reducers
})

videni avatar Jun 11 '18 14:06 videni