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

Warn that entities middleware needs to be before redux-saga-thunk #34

Open
orther opened this issue May 20, 2018 · 0 comments
Open

Warn that entities middleware needs to be before redux-saga-thunk #34

orther opened this issue May 20, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@orther
Copy link
Member

orther commented May 20, 2018

To be able to return the normalized (entities) results in the redux-saga-thunk promise the entities middleware needs to be before the redux-saga-thunk middleware. Otherwise the entities middleware isn't called until after the redux-saga-thunk middle returns results.

Ideally we could add a check that would warn if the middlewares were out of order.

The following code examples are from a project using URM that I updated to get the entities values in promise returned from action request.

Previous (Not Working)

export default [
  ReduxSagaThunk,
  ReduxThunk,
  routerMiddleware(browserHistory),
  // NOTE: ^^-- above reducers must be first and in order

  // redux-modules
  entities,
];

Updated (Working)

export default [
  // redux-modules
  entities,

  // following middleware must be in this order
  ReduxSagaThunk,
  ReduxThunk,
  routerMiddleware(browserHistory),
];
@orther orther added enhancement New feature or request good first issue Good for newcomers labels May 20, 2018
@orther orther self-assigned this May 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant