question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Synchronous emit in flush method of debounce produces incorrect result

See original GitHub issue

If 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:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mAAdhaTTahcommented, Nov 28, 2020

@bpinto Done. Let me get a release out this weekend.

0reactions
bpintocommented, Nov 26, 2020

Hey guys, @betalb opened a PR fixing this, do you think we could merge their PR?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found