I'm still new to rxjs, so I'm having trouble on how to do this. I want to perform a side effect when all the observables from my mergeMap completes, but I don't know how to "split" the original stream into a new one.
It looks like from here Wait for all observables in mergeMap to complete before emitting a custom value that I can use ignoreElements
and endsWith(undefined)
but I'd like to keep the original observables from the mergeMap alive
e.g.
action$.pipe(
filter(..),
mergeMap(action => nextAction(action)),
performSideEffectWhenMergeMapDone()
How do I do this?
I've also tried something like this:
const next = action$.pipe(
filter(..),
mergeMap(...))
next.pipe(
ignoreElements(),
endWith(undefined),
tap(() => {...}
})
);
return next
but the tap() never gets hit since the second epic is never registered