-
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
bug(throttle): Does not emit last value on source complete #5732
Labels
bug
Confirmed bug
Comments
I would like to work on this issue. It looks like a good first task to contribute to RxJS. |
Merged
After the refactoring the initial bug is fixed. I created a PR with additional tests. |
Until v7 is released, I'm using this workaround: /**
* Workaround for https://github.com/ReactiveX/rxjs/issues/5732
* Fixed in v7
*/
export const throttleWithFix: typeof RxJSOperators.throttle = (...params) => (ob$) =>
ob$.pipe(
RxJSOperators.publish((published$) => {
const last$ = pipe(published$, RxJSOperators.last());
const throttled$ = pipe(published$, RxJSOperators.throttle(...params));
return RxJS.merge(throttled$, last$);
}),
); |
Is there an option to fix this for a 6.6.7 release? |
Closed? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
throttleTime(n, s, config)
should be equivalent tothrottle(() => timer(n, s), config)
... But it's not. The issue is thatthrottle
does not behave correctly when thesource
completes.If the
source
completes, we'retrailing
, and we have a trailing value already, the result should wait for the throttle duration to end, then emit the last value, then complete the result. If thesource
completes and we don't have a trailing value -- or we're not trailing -- the result should complete.The text was updated successfully, but these errors were encountered: