I am trying to yield an array of saga effects sequentially.
The idea is that yield all([call(foo), call(bar])
will run call(foo)
and call(bar)
in parallel (or at least in a pseudo-parallel fashion).
However, I want my sagas to run sequentially, meaning that I want to wait for foo
to end before lauching bar
(this way I can cancel the process).
This array of call is generated dynamically, so I can hard write a series of yield
. What is the correct syntax in this case ?
The redux-saga documentation has an example of sequencing sagas.
If you have an array of calls, simply yield these in your saga. For example:
// Some array containing call objects
let calls = [...];
// Call each in order they are present in the array
for (let c of calls) {
yield c
}