ReplayAtFirstSubscriptionOnlySubject #7263
lpaolini
started this conversation in
Ideas / Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes I use ReplaySubjects in my code to be able to emit values before the observable is subscribed. That works perfectly fine, but it can lead to a memory leak if the subject never completes, as the ReplaySubject (default configuration) would keep on storing all values forever, to make them available to future subscriptions.
For that kind of use, the ideal would be a ReplaySubject variant which is able to automatically turn itself into a regular Subject after being subscribed for the first time, as soon as the backlog is empty.
There are some implementations on StackExchange, but I think it would be a really important feature to implement natively.
Beta Was this translation helpful? Give feedback.
All reactions