MithrilJS / MithrilJS/mithril.js

mithril stream .map does not trigger next stream value

Open
#2,643 4 comments 0 reactions 1 assignee View on GitHub

@dead-claudia is already working on this.

Since Dec 13, 2020.

Area: Stream Type: Bug
Dominant language
JavaScript
Stars
14.5k
Forks
922
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.