MithrilJS / MithrilJS/mithril.js

Dependent streams should end when their parent ends

Open
#2,315 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

const s = Stream()
const c = stream.map(a => a)
s.end.map(() => console.log('parent ended'))
c.end.map(() => console.log('child ended'))
stream.end(true) // logs "parent ended" and "child ended"

Current Behavior

const s = Stream()
const c = stream.map(a => a)
s.end.map(() => console.log('parent ended'))
c.end.map(() => console.log('child ended'))
stream.end(true) // logs just "parent ended"

Possible Solution

Potentially something down the vein of this comment by @pygy, but it may need altered.

Context

I created this issue to track the issue reported in #2030 (a heavily outdated PR targeting the wrong branch).

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.

Research direction

Start by tracing the stream behavior shown in the expected and current examples, then read the discussion linked from issue #2030 and its referenced pull request comment. Done means ending the parent stream also triggers the child stream's end notification, while preserving the parent notification.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.