question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to run Sagas in v0.10?

See original GitHub issue

Hello @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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
gullitmirandacommented, Apr 28, 2016

you intend to add a CHANGELOG?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Run Saga | Redux-Saga
redux-saga provides a way to run a Saga outside of the Redux middleware environment and connect it to a custom Input/Output. import {...
Read more >
How to properly type sagas - redux - Stack Overflow
Try using this: import { type Saga } from 'redux-saga'; export function* fetchUsers(): Saga<void> { some logic... } It works right for ...
Read more >
redux-saga - npm
Saga middleware for Redux to handle Side Effects. ... Start using redux-saga in your project by running `npm i redux-saga`.
Read more >
Top 5 redux-saga Code Examples - Snyk
To help you get started, we've selected a few redux-saga examples, based on popular ways it is used in public projects. Secure your...
Read more >
redux-saga-test-plan | Yarn - Package Manager
Redux Saga Test Plan makes testing sagas a breeze. Whether you need to test exact effects and their ordering or just test your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found