Skip to content

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

@videni

Description

@videni

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
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions