@ngrx/effects BehaviourSubject giving last value to subscribers

Viewed 358

Something I noticed the other day. I was subscribing to the Actions stream inside @ngrx/effects. I noticed (an issue for me) where a component, which subscribes to Actions late, receives the last dispatched action. This I can see is because the dispatcher inside @ngrx/store is a BehaviourSubject and quoting the RxJS docs:

Rx.BehaviorSubject class

Represents a value that changes over time. Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.

Unfortunately, I'd like to subscribe to the actions stream without retrieving the last value. It creates problems for me like showing error messages when a user returns to a page.

The difference between BehaviorSubject and Subject (which does it the way I'd like) is demo'd here:

https://codepen.io/anon/pen/zwgype

Is there any way of achieving this?

1 Answers
Related