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); } }