-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(shareReplay): shareReplay unsubscribe routine is called #3354
Conversation
…bscribe Unsubscribe routine for shareReplay was ingonred. Now it is being called.
8b6987b
to
acbb8e4
Compare
|
||
return () => { | ||
const _unsubscribe = this.unsubscribe; | ||
this.unsubscribe = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that monkey-patching the destination subscriber is what we really want to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will try to refactor shareReplay as a class, like other operators.
…subscription ShareReplay subscribes with ShareReplaySubscriber that recieves an onUnsubscribe callback removeSubscriber is passed to ShareReplaySubscriber as an onUnsubscribe callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a test to verify the change is working.
Actually any unsubscribing/refCount/isComplete logic is currently redundant in shareReplay |
34702f6
to
685bdc3
Compare
source unsubscribes itself upon completion so any other unsubscription logic is redundant
440729f
to
2cd193b
Compare
I think the big debate here with the core team, is we're unsure what the behavior should be in this situation. That's the real hold up with this PR. |
@benlesh, as a proposal, what about having the following unsubscribing behavior for
(Let me know if you'd prefer the discussion happen on #3336) |
My thoughts:
|
@voithos bringing |
Indeed, If I understand correctly, the previous behavior of Still, I think there might be a use case for the behavior I described. As an example, consider an Observable that represents an HTTP request. Ideally:
If it doesn't make sense to have |
Given that this is a breaking change, and the demand for this change in behavior hasn't been especially high, I'm going to close this issue for now. @liqwid, I really appreciate your effort here, and I know it sucks to have a PR closed. Hopefully that doesn't put you off from contributing again in the future! Thank you again! |
Unsubscribe routine for shareReplay was ingonred. Now it is being called.
Related issue (if exists):
Fixed while exploring #3336 however does not fix the issue, details in the issue comments.