-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debounceTime
does not emit
#6375
Comments
IMO, in situations like this - when you see what appears to be a fundamental bug - it's worthwhile to ask "why do the tests pass?" This is not a bug. It's a misunderstanding. There is no emission because there is no subscription made to the To see that this is a problem, add Also, your expectation is wrong. It's working as intended. |
Thanks for the guidance, it appears that my reproduction needs some additional work. As far as what I do know, the tests in google passed before v7, but do not after v7, so my assumption was that there is something unusual amiss (see #6364) |
It's unfortunate, but the v6/v7 changes document - that was published to the docs site at the time of the release - was not comprehensive. It missed the breaking changes that were listed in the CHANGELOG. Some of those breaking changes related to notifier observables - those used with operators like Anyway, the somewhat-more-comprehensive changes document is not yet on the site, but you can find it here: |
Could this be an issue with google mode (aka super gross mode?) many of the issues we're seeing are only reproducible in that mode. |
@leggechr the example posted was just something that would never work. Basically, there was a hot observable (a subject) through which values were nexted, but it wasn't subscribed to until after the values were nexted. Meaning no one was listening. If you do the correct thing in the test code given, it works just fine: import { Subject, firstValueFrom } from 'rxjs';
import { debounceTime, shareReplay } from 'rxjs/operators';
const duration = 10;
const source = new Subject<string>();
const debouncedSource$ = source.pipe(
debounceTime(duration),
shareReplay(1)
);
// Subscribe in here
firstValueFrom(debouncedSource$).then(value => console.log(value));
// *then* send your values
source.next('should not be emitted'); // debounced away
source.next('expected value');
source.complete(); |
Sorry everyone for the noise. I got too excited when I "reproduced" the issue, and didn't realize the obvious bug in my own code. |
Happens to everyone. |
found in google3 \cc @leggechr
Bug Report
Current Behavior
debounceTime
fails to emit after a given durationExpected behavior
debounceTime
emits after a given durationReproduction
https://stackblitz.com/edit/rxjs-k9cnyb?file=index.ts
Environment
The text was updated successfully, but these errors were encountered: