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

When a Bacon.fromArray stream is done .take(N) produces N x undefined events

semmel opened this issue · comments

Using Bacon.version 2.0.9 on Node.js 8.14.0 multiple .take(N) on a Bacon.fromArray() stream which is already completed, produce N times undefined for the subscriber. Bacon.sequentially works fine:

var s1 = Bacon.fromArray([0, 1, 2, 3]);
s1.take(2).log(); // -> 0, 1, <end>
s1.take(2).log(); // -> 2, 3, <end>
s1.take(2).log(); // -> undefined, undefined, <end> BUT SHOULD BE JUST <end>
// btw.
s1.take(N).log() // -> N x undefined , <end>

// Bacon.sequentially works as I would expect:
var s2 = Bacon.sequentially(10, [0, 1, 2, 3]);
s2.take(2).log(); // -> 0, 1, <end>
s2.take(2).log(); // -> 2, 3, <end>
s2.take(2).log(); // -> <end>

Hmmm looks bad, must investigate. I'll try to get some time for this soon, but I have a very busy week going on. Would greatly appreciate if you had a gander yourself trying to point out the problem.

Would greatly appreciate if you had a gander yourself trying to point out the problem.

Busy here as well, but I'll do...

Fixed in 2.0.10. Thanks @semmel !