Skip to content
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 dropping values received in subscription #2748

Closed
maxkostow opened this issue Jul 13, 2017 · 3 comments · Fixed by #3218 or Xenira/Shashki#66
Closed

debounceTime dropping values received in subscription #2748

maxkostow opened this issue Jul 13, 2017 · 3 comments · Fixed by #3218 or Xenira/Shashki#66

Comments

@maxkostow
Copy link

maxkostow commented Jul 13, 2017

RxJS version: 5.4.2

Code to reproduce:

const s = new Subject()
s.debounceTime(0).subscribe(n => {
    if (n === 1) {
        s.next(2)
    }
    console.log(n)
})
s.next(1)

Expected behavior:
Should output -1-2

Actual behavior:
Output: -1

Additional information:
lastValue/hasValue are cleared out after _next is called synchronously.
https://github.com/ReactiveX/rxjs/blob/master/src/operator/debounceTime.ts#L98-L102

@kwonoj
Copy link
Member

kwonoj commented Jul 13, 2017

#2155 (comment)

Basically Rx v5 doesn't guarantee reentrancy by default. If you explicitly observe in different scheduler like .observeOn(Rx.Scheduler.asap) then you can see it's not trapped anymore.

image

@kwonoj kwonoj closed this as completed Jul 13, 2017
@maxkostow
Copy link
Author

Cool, thanks that's exactly the workaround I came up with.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants