Angular · Senior · Question 52 of 75
What is the risk of shareReplay(1) without refCount: true on a long-lived source?
- ✓Correct answer: The inner subscription stays alive after all subscribers leave, which can leak memory or keep a socket/poll running
- 2Late subscribers don't get the last value
- 3It sends a request per subscriber
Explanation
shareReplay({ bufferSize: 1, refCount: true }) unsubscribes from the source when the subscriber count drops to zero. For one-shot HTTP calls it matters less.