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

Bug? Perhaps improper behavior of throttle(fn) #2466

Closed
benlesh opened this issue Mar 15, 2017 · 1 comment
Closed

Bug? Perhaps improper behavior of throttle(fn) #2466

benlesh opened this issue Mar 15, 2017 · 1 comment

Comments

@benlesh
Copy link
Member

benlesh commented Mar 15, 2017

RxJS version: 5.0.0-alpha.* to 5.2.0

Code to reproduce:

Observable.of(1, 2, 3).throttle(() => { throw new Error('oops'); })
  .subscribe(x => console.log(x), err => console.log(err.message));

Expected behavior:

logs:

1
"oops"

Actual behavior:

logs

"oops"

Additional information:

Apparently, the durationSelector function is called, and it's result is subscribed to before the leading value is emitted. This seems unintuitive, as it's that value that triggered the need to get the duration notifier from the durationSelector to begin with.

If we "fix" this, it is, indeed, a breaking change.

@benlesh
Copy link
Member Author

benlesh commented May 21, 2018

Closing as stale

@benlesh benlesh closed this as completed May 21, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
MatthiasKunnen added a commit to MatthiasKunnen/rxjs that referenced this issue Apr 23, 2019
Fix an issue with throttleTime emitting both leading and trailing values in the same time window.

Double emission problem:
source:   a123b12-c-23d-2-ef---
expected: a---b---c---d---e---f
actual:   a---b1---c2---2-e---f

Closes ReactiveX#2466 and ReactiveX#2727.
Follows ReactiveX#2749 and ReactiveX#2864.

BREAKING CHANGE: throttleTime no longer emits both leading and trailing
values in the same time window.
MatthiasKunnen added a commit to MatthiasKunnen/rxjs that referenced this issue Jul 24, 2019
Fix an issue with throttleTime emitting both leading and trailing values in the same time window.

Double emission problem:
source:   a123b12-c-23d-2-ef---
expected: a---b---c---d---e---f
actual:   a---b1---c2---2-e---f

Closes ReactiveX#2466 and ReactiveX#2727.
Follows ReactiveX#2749 and ReactiveX#2864.

BREAKING CHANGE: throttleTime no longer emits both leading and trailing
values in the same time window.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant