How to take multiple actions without knowing which one is dispatched first?

Viewed 3256

How do I wait for both ACTION_A and ACTION_B to be dispatched without knowing which one was dispatched first?

I tried const result = yield take([ACTION_A, ACTION_B]) but result is only the first dispatched action, whereas I need both actions.

I tried const {a, b} = yield race({a: yield take(ACTION_A), b: yield take(ACTION_B)}) but if a is defined, b is not.

Remember I can't simply yield take(ACTION_A); yield take(ACTION_B) because I don't know which one comes first.

1 Answers
Related