preloader
心得

Execution orders of actions of Redux Observable Epic

Execution orders of actions of Redux Observable Epic

Received same action(s) within redux will be executed first and then one(s) in epic(s) of redux-observable if there are common action(s) existing in redux and redux-observable.[1]

Excerpt statement from redux-observable official site
Figure 1. Excerpt statement from redux-observable official site

 

Execution order of received actions for redux and redux-observable
[2] Figure 2. Order sequence diagram for redux-observable. Photo credit to Brian Leathem [3]  

Redux store is action-in and state-out. Redux-observable is action-in and action-out.  

Behavior of redux means it generate out new centralize-management state tree depending on receiving action’s type. Behavior of redux-observable means it generate out new action depending on receiving action’s type. Benefits of redux-observable are describe below:

  1. actions from it can be chainable. For example, we can create cancellable requests with operator takeUntil if sending API request and dealing with exception as using rxjs.
  2. send actions, which redux are interested in, for generating new state tree so redux-observable can focus on how to handle side-effects.

Reference:

  1. Redux-observable official material - Epic
  2. Brian Leathem - TIMING OF REDUCING ACTIONS WITH REDUX OBSERVABLE
  3. About Brian Leathem