From a93518ae6a443211c4804dd2665bb04450d26614 Mon Sep 17 00:00:00 2001 From: John Cheevers Date: Fri, 10 Feb 2017 10:45:37 -0600 Subject: [PATCH] fix(switch): ChildSubscriptions removed on inner unsubscribe (#2355) Hold reference to ChildSubscription, not Subscription, so it can be properly removed later. --- src/operator/switch.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/operator/switch.ts b/src/operator/switch.ts index 8e5629fd86..ea936c5ab6 100644 --- a/src/operator/switch.ts +++ b/src/operator/switch.ts @@ -75,7 +75,7 @@ class SwitchSubscriber extends OuterSubscriber { protected _next(value: T): void { this.unsubscribeInner(); this.active++; - this.add(this.innerSubscription = subscribeToResult(this, value)); + this.innerSubscription = this.add(subscribeToResult(this, value)); } protected _complete(): void { @@ -90,7 +90,6 @@ class SwitchSubscriber extends OuterSubscriber { const innerSubscription = this.innerSubscription; if (innerSubscription) { innerSubscription.unsubscribe(); - this.remove(innerSubscription); } }