How to run Sagas in v0.10?
See original GitHub issueHello @yelouafi
First of all, thanks for this package, it’s honestly the best way to solve async operations with some flow control.
Having this basic sagas:
function * hello () {
try {
console.log('Hallo!')
} catch (e) {
console.log('e', e)
}
}
function * standBy () {
yield delay(1000)
console.log('We are on stand-by!')
}
export default function * sagas () {
yield [
fork(hello),
fork(standBy)
]
}
and enhancing the store like that (as you recommend on the changelog and in the docs):
const sagaMiddleware = createSagaMiddleware()
const storeFactory = compose(
applyMiddleware(
sagaMiddleware(sagas)
)
)(createStore)
sagaMiddleware.run(sagas)
const store = storeFactory(reducers)
I have the error:
middleware.js:44 Uncaught TypeError: next is not a function
That actually is when the generator calls the next() function with the next action. I assume that is a problem with how the middleware behaves with the store.
I’m pretty new to the redux-sagas
and I never get deeply into how babel transpile the generators, so I vaguely understand what’s going there, but I can imagine that is a collection of calls of the correct actions and something is failing there 😢
If you use 0.9.5
for instance and you apply the middleware “normal”(as It was before), works perfectly.
I open this issue, because I was blocked for more than 1 hour trying to know what I was doing wrong.-
and If someone install the packages it will be 0.10
and It won’t run.
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
it’s already there
https://github.com/yelouafi/redux-saga/releases/tag/v0.10.0
https://github.com/yelouafi/redux-saga#mainjs
you intend to add a CHANGELOG?