Skip to content

Instantly share code, notes, and snippets.

@aminmarashi
Last active May 25, 2017 01:00
Show Gist options
  • Save aminmarashi/b484f890695658867d44a62dde621d45 to your computer and use it in GitHub Desktop.
Save aminmarashi/b484f890695658867d44a62dde621d45 to your computer and use it in GitHub Desktop.
non-standard takeEvery that passes payload instead of action to the saga
import { fork, takeEvery } from 'redux-saga/effects';
function* intermediateGen(saga, ...args) {
yield fork(saga, ...args.slice(0, -1), args.slice(-1)[0].payload);
}
export default function customTakeEvery(pattern, saga, ...args) {
return takeEvery(pattern, intermediateGen, saga, ...args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment