I have a hot Observable that I'm using shareReplay(1) to Multicast, but if the Observable is complete and its subscribed to it emits the last value. I need it to not emit anything.
I have a hot Observable that I'm using shareReplay(1) to Multicast, but if the Observable is complete and its subscribed to it emits the last value. I need it to not emit anything.
Instead of shareReplay(1), you should be able to use this instead:
share({
connector: () => new ReplaySubject(1),
resetOnError: true,
resetOnComplete: true,
resetOnRefCountZero: false
})
The resetOnRefCountZero: false just ensures that you can still subscribe again (and receive the shared value) even if all subscribers have unsubscribed at any point.
Note: resetOnError and resetOnComplete default to "true" in the case anyway, but I have added for clarity.