From 29ff7940fd58b38bc1d986adcf0ef84be99fdb1f Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Wed, 11 May 2016 22:54:18 -0700 Subject: [PATCH] fix(subscriptions): fixes bug that tracked subscriber subscriptions twice. --- src/Observable.ts | 6 +++++- src/operator/groupBy.ts | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Observable.ts b/src/Observable.ts index 429d5391d1..19aeb859c9 100644 --- a/src/Observable.ts +++ b/src/Observable.ts @@ -91,7 +91,11 @@ export class Observable implements Subscribable { const { operator } = this; const sink = toSubscriber(observerOrNext, error, complete); - sink.add(operator ? operator.call(sink, this) : this._subscribe(sink)); + if (operator) { + operator.call(sink, this); + } else { + sink.add(this._subscribe(sink)); + } if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; diff --git a/src/operator/groupBy.ts b/src/operator/groupBy.ts index c9a17426e3..4872e64dc1 100644 --- a/src/operator/groupBy.ts +++ b/src/operator/groupBy.ts @@ -76,9 +76,7 @@ class GroupBySubscriber extends Subscriber implements RefCountSubscr private keySelector: (value: T) => K, private elementSelector?: (value: T) => R, private durationSelector?: (grouped: GroupedObservable) => Observable) { - super(); - this.destination = destination; - this.add(destination); + super(destination); } protected _next(value: T): void {