Skip to content

Commit

Permalink
fix(SubscribeOnObservable): Add the source subscription to the action…
Browse files Browse the repository at this point in the history
… disposable so the source will

This fix makes SubscribeOnObservable keep track of the source subscription. Before, the source

subscription wouldn't be disposed.
  • Loading branch information
trxcllnt committed Dec 8, 2016
1 parent 89b506d commit 64e3815
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/observable/SubscribeOnObservable.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Action } from '../scheduler/Action';
import { Scheduler } from '../Scheduler';
import { Subscriber } from '../Subscriber';
import { Subscription } from '../Subscription';
Expand All @@ -20,9 +21,9 @@ export class SubscribeOnObservable<T> extends Observable<T> {
return new SubscribeOnObservable(source, delay, scheduler);
}

static dispatch<T>(arg: DispatchArg<T>): Subscription {
static dispatch<T>(this: Action<T>, arg: DispatchArg<T>): Subscription {
const { source, subscriber } = arg;
return source.subscribe(subscriber);
return this.add(source.subscribe(subscriber));
}

constructor(public source: Observable<T>,
Expand Down

0 comments on commit 64e3815

Please sign in to comment.