colinbate / redux-form-submit-saga

Handles redux-form submissions using redux-saga
MIT License
61 stars 12 forks source link

why do you compose this saga with root? #10

Open anthonychung14 opened 7 years ago

anthonychung14 commented 7 years ago

Looking at the src code, I see that you compose formSubmitSaga with the user's rootSaga.

Why not have this be a module that you can just import rather than wrapping the root saga?

Was there an implementation difficulty associated with having this form-submit saga be standalone? Or did you craft it this way for usability?

colinbate commented 7 years ago

A good question. :)

The answer is that based on the wording in the redux-saga documentation, I always assumed you could only have a single root saga. However, having just tried to invoke middleware.run with the library saga separately, I see that it works fine.

As it is implemented now you can do: middleware.run(addFormSubmitSagaTo()) in addition running your own root saga separately. However, the name of this function doesn't make as much sense in this context. I may add an alias and update the documentation.

Thanks.

ismay commented 7 years ago

Allowing the user to just import the saga would also fix the warning that redux-saga@0.15.1 now displays when yielding an array of sagas:

[...effects] has been deprecated in favor of all([...effects]), please update your code

Took me a while to find that this line was what was causing the warning.