Skip to content
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

feat(Subscription): idempotent add and remove of teardowns #6401

Merged
merged 2 commits into from Sep 19, 2021

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented May 12, 2021

  • Adding the same instance of a teardown more than once is the same as adding it once
  • Removing a teardown with Subscription.prototype.remove will remove it much faster

BREAKING CHANGE: Adding the same function instance to a subscription as a teardown multiple times will now result in that function being executed only once on teardown. This brings us inline with the behavior of EventTarget, and also makes removing teardowns faster. The workaround is to make sure you are adding a new function instance to the Subscription each time if you need the same effect.

Resolves #6400

- Adding the same instance of a teardown more than once is the same as adding it once
- Removing a teardown with `Subscription.prototype.remove` will remove it much faster

BREAKING CHANGE: Adding the same function instance to a subscription as a teardown multiple times will now result in that function being executed only once on teardown. This brings us inline with the behavior of EventTarget, and also makes removing teardowns faster. The workaround is to make sure you are adding a new function instance to the Subscription each time if you need the same effect.

Resolves ReactiveX#6400
@benlesh benlesh added the 8.x Issues and PRs for version 8.x label May 12, 2021
@benlesh benlesh requested a review from cartant May 12, 2021 17:59
@benlesh benlesh mentioned this pull request May 19, 2021
40 tasks
@benlesh benlesh changed the base branch from master to 8.x September 14, 2021 21:03
@benlesh
Copy link
Member Author

benlesh commented Sep 14, 2021

Changed the base to 8.x branch, since that's where this should be going.

@benlesh benlesh merged commit d197e40 into ReactiveX:8.x Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Issues and PRs for version 8.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to using Set for Subscription teardowns
3 participants