Skip to content

Is it possible to not activate a staled observable when reactivating flatMapLatest? #310

@wongcy0

Description

@wongcy0

Hi, I am looking for a way to avoid the activation of an observable created from a previous activation of flatMapLatest.

let pool = Kefir.pool();
let foo = pool.toProperty();
let bar = foo.flatMapLatest(v => {
  return Kefir.stream(emitter => {
    console.log("Activation " + v);
    // ...
  });
});

foo.observe();

pool.plug(Kefir.constant(1));

bar.log("bar");
// Activation 1
bar.offLog("bar");

pool.plug(Kefir.constant(2));

bar.log("bar");
// Activation 1 <-- unwanted activation
// Activation 2

Any input would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions