[question/clarification] Starting root sagas
See original GitHub issueI’m just trying to figure out how to start a root saga the correct way.
In your beginner tutorial (http://yelouafi.github.io/redux-saga/docs/introduction/BeginnerTutorial.html) you start the root saga this way:
// single entry point to start all Sagas at once
export default function* rootSaga() {
yield [
helloSaga(),
watchIncrementAsync()
]
}
But in the most examples (like https://github.com/yelouafi/redux-saga/blob/master/examples/shopping-cart/src/sagas/index.js) you start it this way:
export default function* root() {
yield [
fork(getAllProducts),
fork(watchGetProducts),
fork(watchCheckout)
]
}
See also https://github.com/yelouafi/redux-saga/issues/276 and https://github.com/yelouafi/redux-saga/issues/171.
My first idea was that variant 1 starts the second saga in the array when the first is completed, but you explicitly say that this is not the case:
We’re yielding an array with the results of the calls to the 2 sagas. This means the 2 resulting Generators will be started in parallel.
So what’s the difference? I did not find any hint in the docs, but maybe I overlooked something.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Starting rootSaga is still a big source of confusion to me. I asked a question about it on stackoverflow. http://stackoverflow.com/questions/39438005/what-is-the-idiomatic-way-of-starting-rootsaga. Would really appreciate, if someone gives a thorough answer.
@ms88privat I think it’s the same and the only difference is spawn is detached