rxjs-autorun icon indicating copy to clipboard operation
rxjs-autorun copied to clipboard

Cover multiple sync emissions

Open kosich opened this issue 3 years ago • 0 comments

Currently, we are skipping multiple sync emissions. This will wait for all 3 values from a and only then would produce a result:

const a = of(1, 2, 3);
const b = of('🐁');
computed(() => $(a) + $(b)).subscribe(…); // > 3🐁

I think its fine for computed, but it seems to be an issue for our shiny new combined (or whatever name we end up with in #32):

combined(() => $(a) + $(b)).subscribe(…); // > 1🐁 > 2🐁 > 3🐁

Though it's not very clear how to handle this with multiple streams emitting synchronously.

combineLatest ignores sync values from the first stream:

const a$ = of(1,2,3);
const b$ = of('a', 'b', 'c');
const result$ = combineLatest(a$, b$);
combinelatest---rxjs-operator-example---marble-diagram

So, I'm not sure if, what, and how it should be done. Please, share your thoughts!

kosich avatar Oct 24 '20 14:10 kosich