Skip to content

Commit

Permalink
fix(throttle): ChildSubscriptions removed on inner unsubscribe (React…
Browse files Browse the repository at this point in the history
…iveX#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 3a926b9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/operator/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ class ThrottleSubscriber<T, R> extends OuterSubscriber<T, R> {
}

private emitAndThrottle(value: T, duration: SubscribableOrPromise<number>) {
this.add(this.throttled = subscribeToResult(this, duration));
this.throttled = this.add(subscribeToResult(this, duration));
this.destination.next(value);
}

protected _unsubscribe() {
const throttled = this.throttled;
if (throttled) {
this.remove(throttled);
this.throttled = null;
throttled.unsubscribe();
}
Expand Down

0 comments on commit 3a926b9

Please sign in to comment.