Current Behavior
debounce and debounceTime emit right away when they reach the end of the observable they are debouncing as described in https://stackoverflow.com/a/55248103/5692151. This behavior is not described in the doc https://rxjs-dev.firebaseapp.com/api/operators/debounceTime
Reproduction
Expected behavior
If I understand correctly what the doc says, the observable should be emiited after a duration dueTime but not immediately.
Environment
IMO, this isn't a bug and is reasonable behaviour. The point of denouncing is to ensure notifications are not emitted too quickly. If the source completes, there will be no further notifications, so emitting the last notification right away is justifiable. I see no reason to wait out the delay.
Hello @cartant
If so, won't it be nice to mention such behavior in the doc? :) It's not really obvious.
Yeah, if it's the expected behaviour, it should be mentioned in the docs.
Also, I guess it could be argued that it should be delayed in some circumstances. If the source emits a value shortly after an already-debounced value has been emitted from the operator, there are situations in which the subscriber could receive two notifications that are separated by an interval less than the specified duration.
Most helpful comment
Yeah, if it's the expected behaviour, it should be mentioned in the docs.
Also, I guess it could be argued that it should be delayed in some circumstances. If the source emits a value shortly after an already-debounced value has been emitted from the operator, there are situations in which the subscriber could receive two notifications that are separated by an interval less than the specified duration.