Coder Social home page Coder Social logo

Comments (8)

mAAdhaTTah avatar mAAdhaTTah commented on June 12, 2024 1

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

from kefir.

mAAdhaTTah avatar mAAdhaTTah commented on June 12, 2024

Without having investigated, the issue is probably less about synchronous emit and more about the circular dependency between a & b.

from kefir.

betalb avatar betalb commented on June 12, 2024

yes, there is a cycle, but it is not infinite and is actually done to illustrate an issue

Here is another more dirty example that produces the same result

let e;
Kefir.stream((emitter) => { e = emitter; })
  .debounce(100)
  .withHandler((emitter, event) => {
    if (event.type === 'value' && event.value === 1) {
      e.emit(2);
    }
    emitter.emitEvent(event)
  }).log();
e.emit(1);

Actually I created PR that should highlight where the issues seems to be. And there are similar problems in buffer-by, buffer-while-by (I just wanted to create cleaner test case before creating separate ticket)

from kefir.

rpominov avatar rpominov commented on June 12, 2024

This is documented behaviour:

image

Although documentation might be more clear probably. My idea was back then is that synchronous events is not a use case I wanted to support well in the library in general.

from kefir.

betalb avatar betalb commented on June 12, 2024

@rpominov I'm not following documentation quote, for me it sound like a different case, which I never faced 🙂

This issue is not with the fact that some value is emitted without being debounced, but completely wrong value (null) being emitted

Also I've provided 2nd example that doesn't use properties and here is 1st example without using properties either

const a = Kefir.pool();
const b = a.debounce(100).spy();
a.plug(b.filter((val) => val === 1).map(() => 2));
a.plug(Kefir.stream(emitter => { emitter.emit(1) }));
a.observe();

from kefir.

mAAdhaTTah avatar mAAdhaTTah commented on June 12, 2024

@rpominov The issue isn't that it's emitted synchronously (it actually isn't, according to the issue description), but that the second event is dropped.

from kefir.

rpominov avatar rpominov commented on June 12, 2024

Ah, right, sorry

from kefir.

bpinto avatar bpinto commented on June 12, 2024

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

from kefir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.