Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
videni opened this issue Jun 11, 2018 · 0 comments

Comments

@videni
Copy link

videni commented Jun 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant