-
-
Notifications
You must be signed in to change notification settings - Fork 924
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
Mithril stream.end(true) ends other dependent streams as well #2601
Comments
Could you provide a fuller repo of this? Ideally a Flems? It'd be much easier to figure out if it's by design or a proper bug - every stream library's behavior is just the sum of a ton of subtlety. |
@isiahmeadows the two links above ("mithril stream" and "flyd stream") are Flems showing the issue. |
Yeah, that's a nasty bug. Didn't pay close attention to the links. Sorry! |
Just for clarity, here's a minimal example that doesn't involve nesting: link |
No worries! The minimal example doesn't expose the bug though... does it? |
@foxdonut It prints the same thing as your Mithril link. I just removed some unnecessary printing. |
@isiahmeadows Please have a closer look because it's not the same thing and it does not expose the bug. In my Mithril link, notice that o2 doesn't receive the |
Oh, whoops. You're right, my bad. 🤦♀️ |
I'm pretty sure this has to do with ending a stream within a dependent stream's map. What's really going is better illustrated here. Note that after o1 gets ended, o2 is missing but o3-5 show results. This is because as the parent stream is executing, the end call unregisters the child and splices the dependent streams/dependent functions during the iteration which causes the skip. I agree this isn't ideal behavior and probably the simple fix is to mark stream removal, check for stream removal before fn execution, unregister all marked for removal streams after the execution calls. Thoughts? |
@jaydh The actual issue is much simpler: it's skipping all remaining children, even ones that weren't ended, even though they remain subscribed - note that in the subsequent emit after that one, it's still received by both streams. I suspect a |
@isiahmeadows That is not what is happening here. Note that after o1 gets ended in the execution of o2, o3 gets skipped, but o4 and o5 still print results. This behavior is explained in the source, when invoking
|
Now that I look closer, that's even weirder. |
**Mithril version: 2.0.4
Browser and OS: Windows 10, Chrome Version 83.0.4103.61
Project:
mithril stream vs flyd stream
credit to @foxdonut for the reproduction
notice in the mithril example how o2 doesn't receive the false value
but using the same example with flyd, o2 does receive the false value
The code I was writing was this:
The unexpected behaviour i experience is that when there were X numbers of
waiting
streams the codewaiting.end(true)
seemed to end ALL of themThe text was updated successfully, but these errors were encountered: