Skip to content

Commit 29ff794

Browse files
trxcllntbenlesh
authored andcommitted
fix(subscriptions): fixes bug that tracked subscriber subscriptions twice.
1 parent d1412bc commit 29ff794

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Observable.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ export class Observable<T> implements Subscribable<T> {
9191
const { operator } = this;
9292
const sink = toSubscriber(observerOrNext, error, complete);
9393

94-
sink.add(operator ? operator.call(sink, this) : this._subscribe(sink));
94+
if (operator) {
95+
operator.call(sink, this);
96+
} else {
97+
sink.add(this._subscribe(sink));
98+
}
9599

96100
if (sink.syncErrorThrowable) {
97101
sink.syncErrorThrowable = false;

src/operator/groupBy.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ class GroupBySubscriber<T, K, R> extends Subscriber<T> implements RefCountSubscr
7676
private keySelector: (value: T) => K,
7777
private elementSelector?: (value: T) => R,
7878
private durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>) {
79-
super();
80-
this.destination = destination;
81-
this.add(destination);
79+
super(destination);
8280
}
8381

8482
protected _next(value: T): void {

0 commit comments

Comments
 (0)