Wait for sequence of action with a Redux Observable

Viewed 6558

I have a use case where I need to wait for a sequence of actions before I dispatch another using Redux Observables. I've seen some similar questions but I cannot fathom how I can use these approaches for my given use case.

In essence I want to do something like so:

action$
  .ofType(PAGINATION_CLICKED) // This action occurred.
  .ofType(FETCH_SUCCESS) // Then this action occurred after.
  .map(() => analyticsAction()); // Dispatch analytics.

I would also like to cancel and start that sequence over again if another action of type FETCH_ERROR fires for example.

1 Answers
Related