Skip to content

Commit

Permalink
fix(switch): ChildSubscriptions removed on inner unsubscribe (Reactiv…
Browse files Browse the repository at this point in the history
…eX#2355)

Hold reference to ChildSubscription, not Subscription, so it can be properly removed later.
  • Loading branch information
johncvrs committed Feb 10, 2017
1 parent 31dfc73 commit a93518a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/operator/switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SwitchSubscriber<T, R> extends OuterSubscriber<T, R> {
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 {
Expand All @@ -90,7 +90,6 @@ class SwitchSubscriber<T, R> extends OuterSubscriber<T, R> {
const innerSubscription = this.innerSubscription;
if (innerSubscription) {
innerSubscription.unsubscribe();
this.remove(innerSubscription);
}
}

Expand Down

0 comments on commit a93518a

Please sign in to comment.