Rock
Rock

Reputation: 11

how to cancel effects in yield all

in dva effect:

//useful; when next action come, the last action will be cancelled;

    getsome: [function*({ payload }, { call, put, select, all }){
      yield call request1;
      yield call request2;
    }, { type: 'takeLatest'}],

//but if use yield all, the last action will not be cancelled

    getsome: [function*({ payload }, { call, put, select, all }){
      yield all([call(request1), call(request2)]);
    }, { type: 'takeLatest'}],

Upvotes: 1

Views: 219

Answers (1)

Vivek Doshi
Vivek Doshi

Reputation: 58553

Simply, You can't do it,

yield all,will start all the calls at same time,but not one after another.

So if you want to cancel the some of the requests you need to do it single, or make groups of yield, and init those one by by.

Upvotes: 1

Related Questions