-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugConfirmed bugConfirmed bug
Description
Bug Report
Current Behavior
Currently subscription isn't removed from observers array after unsubscribe, both with takeUntil() and unsubscribe().
Reproduction
function called() { console.log('CALLED'); }
const subject = new Subject();
const destroyed = new Subject();
const subscription = subject
.pipe(takeUntil(destroyed))
.subscribe(() => called());
console.log(subject.observers.length); // 1
subject.next(); // CALLED
subject.next(); // CALLED
// Unsubscribe from subject
destroyed.next(true);
destroyed.complete();
console.log(subject.observers.length); // Still 1, expected: 0
subscription.unsubscribe();
subject.next(); // no console.log('CALLED')
console.log(subject.observers.length); // Still 1, expected: 0
Expected behavior
In 2 last console.log(subject.observers.length) it's expected to have 0 : observer should be removed from array of observers after unsubscribe()
Environment
- RxJS version:
- 6.3.3
Additional notes
It isn't reproducible with rxjs version 6.2.2
jnizet, tolikrss, ChristofferSkog21st, hadirsa and JanEggers
Metadata
Metadata
Assignees
Labels
bugConfirmed bugConfirmed bug