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.

`yield* takeEvery` causing 'not a function' error

See original GitHub issue

Basically more or less the same as the examples from the README. Using the following code:

import { CREATING_LIVE_SHARE } from '../actions/liveShare';

export function* createLiveShare({ server }) {
  // ...
}
export function* watchLiveShare() {
  yield* takeEvery(CREATING_LIVE_SHARE, createLiveShare);
}
import watchLiveShare from '../sagas/liveShare';

const sagaMiddleware = createSagaMiddleware(watchLiveShare);
const store = createStore(
  // ...
  applyMiddleware(sagaMiddleware)
);

The error I get is:

watchLiveShare: uncaught TypeError: (0 , _reduxSaga.takeEvery)(...)[(intermediate value)] is not a function

It works fine when I remove the * character from the yield statement, i.e. yield takeEvery(...);. I am not quite clear what yield* does compared to yield and if it is required.

Just in case it’s relevant, I am using babel-preset-es2015-node5 in node, so generators are not being polyfilled.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MichalBurescommented, Mar 21, 2016

0.9.5 fixes this issue for me. Thanks!

1reaction
yelouaficommented, Mar 21, 2016

Oops! forgot to mention this in release notes. Thanks for the remainder

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get Redux put to work within generator function
I think you're yielding (pausing) the generator function without calling next on it. Saga has functionality for this.
Read more >
API Reference - Redux-Saga
Each function below returns a plain JavaScript object and does not perform any execution. ... takeEvery is a high-level API built using take...
Read more >
adobe/redux-saga-promise - npm.io
If the saga function throws an error, the promise will be rejected with that ... not implemented yet") } function * rootSaga ()...
Read more >
Easiest way to test asynchronous redux sagas with jest
Let us create our helper function first which will fetch the list of movies. ... yield takeEvery('MOVIE_FETCH_REQUESTED', fetchMoviesSaga);
Read more >
Testing side effects using redux saga - Instea
In sagasall side effects should be created using helper functions from ... yield put({type: 'FETCH_ARTICLE_FAILED', error}).
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