Skip to content

Commit 64e3815

Browse files
committed
fix(SubscribeOnObservable): Add the source subscription to the action disposable so the source will
This fix makes SubscribeOnObservable keep track of the source subscription. Before, the source subscription wouldn't be disposed.
1 parent 89b506d commit 64e3815

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/observable/SubscribeOnObservable.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Action } from '../scheduler/Action';
12
import { Scheduler } from '../Scheduler';
23
import { Subscriber } from '../Subscriber';
34
import { Subscription } from '../Subscription';
@@ -20,9 +21,9 @@ export class SubscribeOnObservable<T> extends Observable<T> {
2021
return new SubscribeOnObservable(source, delay, scheduler);
2122
}
2223

23-
static dispatch<T>(arg: DispatchArg<T>): Subscription {
24+
static dispatch<T>(this: Action<T>, arg: DispatchArg<T>): Subscription {
2425
const { source, subscriber } = arg;
25-
return source.subscribe(subscriber);
26+
return this.add(source.subscribe(subscriber));
2627
}
2728

2829
constructor(public source: Observable<T>,

0 commit comments

Comments
 (0)