mithril.js icon indicating copy to clipboard operation
mithril.js copied to clipboard

mithril stream .map does not trigger next stream value

Open foxdonut opened this issue 4 years ago • 4 comments

Mithril version:

2.0.4

Browser and OS:

Chrome on Mac OSX

Project:

Meiosis

Steps to Reproduce

  • Create an update stream
  • Create a states stream by scanning the `update stream
  • Call states.map(state => effect(state) where effect triggers another update

Expected Behavior

  • Expect the effect function 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 effect function 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 effect function 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 avatar Dec 13 '20 21:12 foxdonut

@foxdonut have you investigated how to fix this?

pygy avatar Jan 16 '21 14:01 pygy

@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.

foxdonut avatar Jan 16 '21 14:01 foxdonut

Thanks, I'll have to dig into that then :-) (unless you beat me to a PR)

pygy avatar Jan 16 '21 16:01 pygy

@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.

ericop avatar Mar 19 '21 17:03 ericop