tap() isn’t triggered in RXJS Pipe

Imagine RxJS pipes like actual, physical pipes with a valve at the end. Each pipe will “modify” the liquid that is flowing through it, but as long as the valve at the end is closed, nothing will ever flow.

So, what you need, is to open the valve at the end. This is done by subscribing to the observable pipe. The easiest solution is:

this.actions$.pipe(
    ofType(LayoutActions.Types.CHANGE_THEME),
    takeUntil(this.destroyed$),
    tap(() => {
        console.log('test')
    }),
).subscribe(_ => console.log("water is flowing!"));

Leave a Comment