Creates an effect that instructs the middleware to queue the actions matching
pattern using an event channel. Optionally, you can provide a buffer to
control buffering of the queued actions.
Example
The following code creates a channel to buffer all USER_REQUEST actions.
Note that even the Saga may be blocked on the call effect. All actions that
come while it's blocked are automatically buffered. This causes the Saga to
execute the API calls one at a time
import { actionChannel, call } from 'redux-saga/effects'
import api from '...'
Creates an effect that instructs the middleware to queue the actions matching
pattern
using an event channel. Optionally, you can provide a buffer to control buffering of the queued actions.Example
The following code creates a channel to buffer all
USER_REQUEST
actions. Note that even the Saga may be blocked on thecall
effect. All actions that come while it's blocked are automatically buffered. This causes the Saga to execute the API calls one at a timeimport { actionChannel, call } from 'redux-saga/effects' import api from '...'
function* takeOneAtMost() { const chan = yield actionChannel('USER_REQUEST') while (true) { const {payload} = yield take(chan) yield call(api.getUser, payload) } }