mithril.js
mithril.js copied to clipboard
mithril stream .map does not trigger next stream value
Mithril version:
2.0.4
Browser and OS:
Chrome on Mac OSX
Project:
Steps to Reproduce
- Create an
updatestream - Create a
statesstream byscanning the `update stream - Call
states.map(state => effect(state)whereeffecttriggers anotherupdate
Expected Behavior
- Expect the
effectfunction to be called again - Here is a flems showing the expected behavior
- Notice the output on the console:
{ route: 'Home', routeChanged: true, data: [] }{ route: 'Home', routeChanged: false, data: [], loading: true }{ route: 'Home', routeChanged: false, data: [ 'duck', 'quack' ], loading: false }
Current Behavior
- The
effectfunction is not called again - Here is a flems showing the current behavior
- Notice the output on the console:
{ route: 'Home', routeChanged: true, data: [] }{ route: 'Home', routeChanged: false, data: [], loading: true }
- The third state is missing because the
effectfunction should have been called again, but it is not.
Context
This is to set up the Meiosis pattern with Effects.
Note: This commit fixes the same issue in Meiosis-Setup's simple-stream.
@foxdonut have you investigated how to fix this?
@pygy yes, see the last line of my description above, there is a link to a commit showing how I fixed it in simple-stream. I figure the fix should be similar in mithril stream.
Thanks, I'll have to dig into that then :-) (unless you beat me to a PR)
@pygy here is a working flems based on @foxdonut example. I tried making a PR, but with other changes in the next branch were beyond my wizardry to make play nice together.