baconjs / bacon.js

Functional reactive programming library for TypeScript and JavaScript

Home Page:https://baconjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

debounce swallows initial value?

pvakevai opened this issue · comments

With bacon v2.0.11

Bacon.mergeAll(Bacon.Bus().toProperty('')).toProperty().doLog('1').debounce(500).log('2')

Does not produce output that I would expect. (both 1 and 2)

Thanks! I'll investigate this. Looks like a bug related to the "all eventstreams are now asynchronous" change in 2.0.

@pvakevai
Have you looked at debounceImmediate?

Looking at the marble diagram of debounce it is ok for it to swallow a lot of events.

source:             asdf----asdf----
source.debounce(2): -----f-------f--

I found the bug. It's simple. Just a sec...

The bug is not related to debounce and friends. It's mergeAll instead, passing Initial events into an EventStream, that should never happen.

Fixed in 3.0.1 and 2.0.12.

Closing now. Please re-open if the fix doesn't help.