Skip to content

Commit 9dd27d6

Browse files
Andre Medeirosbenlesh
authored andcommitted
fix(Subject): fix missing unsubscribe call
Fix a bug manifested when running the test 'Observable.prototype.bufferWhen should emit buffers using varying hot closings'. These changes are important to make unsubscriptions appear for that test. Relates to #381.
1 parent 50e9163 commit 9dd27d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/subjects/SubjectSubscription.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Subject from '../Subject';
22
import Subscription from '../Subscription';
33
import Observer from '../Observer';
4+
import Subscriber from '../Subscriber';
45

56
export default class SubjectSubscription<T> extends Subscription<T> {
67
isUnsubscribed: boolean = false;
@@ -25,6 +26,9 @@ export default class SubjectSubscription<T> extends Subscription<T> {
2526
return;
2627
}
2728

29+
if (this.observer instanceof Subscriber) {
30+
(<Subscriber<T>> this.observer).unsubscribe();
31+
}
2832
const subscriberIndex = observers.indexOf(this.observer);
2933

3034
if (subscriberIndex !== -1) {

0 commit comments

Comments
 (0)