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

why do you compose this saga with root? #10

Open
anthonychung14 opened this issue Mar 9, 2017 · 2 comments
Open

why do you compose this saga with root? #10

anthonychung14 opened this issue Mar 9, 2017 · 2 comments

Comments

@anthonychung14
Copy link

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
Copy link
Owner

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.

@ghost
Copy link

ghost commented May 4, 2017

Allowing the user to just import the saga would also fix the warning that [email protected] 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.

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

2 participants