jeffbski / redux-logic

Redux middleware for organizing all your business logic. Intercept actions and perform async processing.
MIT License
1.81k stars 107 forks source link

processReturn plus processMultiple #154

Open adambiltcliffe opened 5 years ago

adambiltcliffe commented 5 years ago

It's possible to set dispatchReturn to true explicitly but also accidentally enable dispatchMultiple implicitly by including the full signature of the process hook:

  processOptions: {
    dispatchReturn: true,
    successType: auth.actions.logout_success,
    failType: auth.actions.logout_failure
  },
  process({ getState, action, client }, dispatch, done) {
    return client.logout();
  }

This combination can only ever be an error (the logic cannot end), but redux-logic does not warn you about it until the warnTimeout is reached. It seems like it would be beneficial to log an error in development mode along the lines of "You should not include dispatch or done as arguments to process() if processOptions.dispatchReturn is set to true".