I want to dispatch an action multiple times from my effect, for that purpose i am using concatMap, but as i am dispatching same action, it gets cancelled by its next dispatch. Is there a way to dispatch an action, when its previous dispatch gets completed.
Below code will help to understand the problem better.
@Effect()
setCategory$ = this.actions$
.ofType(GET_SESSION_AD_SUCCESS)
.concatMap((action: Action) => {
const category = action.payload;
const categoryPath = category.path;
const categoryDispatchArray = [];
categoryPath.forEach((path, index) => {
categoryDispatchArray.push({
type: GET_SUBCATEGORIES_BY_PARENT,
payload: { categoryId: path.id, index }
});
})
return dispatchArray;
}