-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signals are lost in some cases #271
Comments
|
@ivan-kleshnin issue was originally produced without using later. It was the most simplest way to make stream give signal async. I updated description and added something to highlight the problem a little bit more. |
Seems like import K from "kefir"
let pool = K.pool()
let prop = pool.toProperty(() => 0)
let stream = K.later(100, null)
.flatMapLatest(() => K.merge([prop.take(1), pool]))
.log('stream')
pool.plug(K.constant(1))
pool.plug(K.constant(2))
pool.plug(K.constant(3))
//---3| Using other properties in |
@ivan-kleshnin in your case when flatMapLatest is run, all the constant signals are already sent. You will get only the latest value by using In my case pool should give signal with value of 1, because that signal is sent after flatMapLatest. |
Yep, makes sense. I never used |
@mehtonen-boox I think this is actually the expected result: Kefir.merge([prop.take(1), pool]); You'd use Kefir.merge([pool, prop.take(1)]);
|
@tweinfeld Thank you! I didn't know the order matters while merging streams. 🤔 Now when I know this I might be able to avoid issues like this. 👍 |
@mehtonen-boox it matters and there's also a difference between static functions and methods. For example |
This should be false, at least my intent was to make them exactly the same. For example Lines 305 to 307 in bacac22
|
Sorry for bad description. What I wanted to say is that sometimes: x.skip(1).merge(y) won't work as you need and K.merge([
y,
x.skip(1),
]) But it also boils down to order dependecy, yes. |
I'm not sure if this is a bug, but I found this strange behavior of signals getting lost on some cases.
I would expect stream to log with 0 and 1, but only 0 gets logged. Or I'm I misunderstanding this somehow?
To clarify issue a little bit, if I change
.flatMapLatest(() => kefir.merge([prop.take(1), pool]))
to.flatMapLatest(() => prop)
it will log 0 and 1. So it seems pool won't give signals in this case even though it should according to my understanding.The text was updated successfully, but these errors were encountered: