It seems that debounceTime
ignores inner calls to it's subjects next
method:
var subject: Subject<number> = new Subject<number>();
subject.pipe(
tap((a) => console.log("tab:" + a)),
debounceTime(300),
).subscribe((a) => {
console.log(a);
subject.next(100)
});
subject.next(19);
subject.next(20);
the code above should create an infinite loop - but it does not:
tab:19
tab:20
20
tab:100
if I add a delay(1)
to the pipe it works as expected:
subject.pipe(
tap((a) => console.log("tab:" + a)),
debounceTime(300),
delay(1)
).subscribe((a) => {
console.log(a);
subject.next(100)
});
am I missing something?
Edit: added an example: https://typescript-fbt2mn.stackblitz.io