If you enter the action CANCEL_MARKETING_CONTENT , you can do something like this with mergeMap :
@Effect() marketingContent$ = this.actions$ .ofType(LOAD_MARKETING_CONTENT) .mergeMap(({ payload }) => this.marketingService .getContent(payload) .map(content => Action.LoadMarketingContentComplete(content)) .takeUntil(this.actions$.ofType(CANCEL_MARKETING_CONTENT)) );
Basically, this will allow you to download as many pieces of marketing content as possible, but you need to discard any pending loads by sending the CANCEL_MARKETING_CONTENT action before sending LOAD_MARKETING_CONTENT actions.
For example, to load only piece A , you would do this:
store.dispatch(Action.CancelMarketingContent()); store.dispatch(Action.LoadMarketingContent('A'));
And to load both parts A and B , you would do this:
store.dispatch(Action.CancelMarketingContent()); store.dispatch(Action.LoadMarketingContent('A')); store.dispatch(Action.LoadMarketingContent('B'));
In fact, there is a similar, but more accurate way to do this, and it does not involve the use of another action.
You can use dispatch of the same action with the same payload as the cancel trigger. For instance:
@Effect() marketingContent$ = this.actions$ .ofType(LOAD_MARKETING_CONTENT) .mergeMap(({ payload }) => this.marketingService .getContent(payload) .map(content => Action.LoadMarketingContentComplete(content)) .takeUntil(this.actions$ .ofType(LOAD_MARKETING_CONTENT) .skip(1) .filter(({ payload: next }) => next === payload) ) );
From skip memory, you need to skip the action that is currently being processed by the effect. And the answer assumes that payload is "A" or "B" , etc.