Skip to content

startWith + combine + combine with itself results in first emitted value ignored #173

@frangio

Description

@frangio

Here's a simplified example of the bug:

const a$ = xs.of('bye').startWith('hello')
const b$ = xs.of('world')

const c$ = xs.combine(a$, b$).map(([a, b]) => a + ' ' + b)

xs.combine(c$, c$).debug(console.log).addListener({
  next: () => {},
  error: () => {},
  complete: () => {},
})

Note that c$ is combined with itself. This also happens if c$ is combined with a stream derived from itself.

This should print

["hello world", "hello world"]
["bye world", "bye world"]

Instead, it only prints the second line.

This is especially bad if a$ is xs.never().startWith('hello'), in which case nothing ever prints... or instead of xs.never() a Cycle.js DOM event stream from an element which isn't in the DOM yet! This exactly led to the app never starting in my case.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions