ReactiveX / ReactiveX/rxjs

bug(throttle): Does not emit last value on source complete

Open
#5,732 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

throttleTime(n, s, config) should be equivalent to throttle(() => timer(n, s), config)... But it's not. The issue is that throttle does not behave correctly when the source completes.

If the source completes, we're trailing, 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 the source completes and we don't have a trailing value -- or we're not trailing -- the result should complete.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the throttle and throttleTime implementations and their existing tests. Reproduce completion with trailing enabled and a pending trailing value, then verify that the final value is emitted after the throttle duration before the result completes; cases without a trailing value should complete directly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.