Synchronous emit in flush method of debounce produces incorrect result
See original GitHub issueIf you will try to do synchronous emit in debounced observable incorrect sequence of events will be produced
i.e.
const a = Kefir.pool();
const b = a.debounce(100).spy();
a.plug(b.filter((val) => val === 1).map(() => 2));
a.plug(Kefir.constant(1));
a.observe();
Expected output
100ms [pool.debounce] <value> 1
200ms [pool.debounce] <value> 2
Actual output
100ms [pool.debounce] <value> 1
200ms [pool.debounce] <value> null
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Flush not called immediately on debounce · Issue #4185
Following on #1816 I noticed that debounce.flush() is called after the timeout and not immediately. Shouldn't the function be called ...
Read more >Debouncing and Throttling Explained Through Examples
Debounce and throttle are two similar (but different!) techniques to control how many times we allow a function to be executed over time....
Read more >Angular: Testing async stuff in the fakedAsync zone VS. ...
it shows the result in the UI and emits the appropriate message; the unit test respects the asynchronous nature of the code and...
Read more >Chapter 4. It's about time you used RxJS ... - liveBook · Manning
Time is a tricky business. We spoke earlier about the challenges that exist when the code you write isn't synchronous; it may have...
Read more >What is the "debounce" function in JavaScript?
The immediate flag is supposed to control whether the function should be called before or after the timer. If it is false ,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bpinto Done. Let me get a release out this weekend.
Hey guys, @betalb opened a PR fixing this, do you think we could merge their PR?