combine breaks when passed two streams that share a parent
See original GitHub issueHere is a runnable reproducer:
import assert from 'assert';
import xs from 'xstream';
function Counter (click$) {
const count$ = click$
.fold((total) => total + 1, 0)
.remember();
return {
count$,
countString$: count$.map(count => count.toString())
};
}
const click$ = xs.create();
const counter = Counter(click$);
const combinedStreams = xs.combine(
(...vals) => vals,
counter.count$,
counter.countString$
);
const expectedValues = [
[0, '0'],
[1, '1']
];
combinedStreams.addListener({
next(vals) {
console.log('expected:', expectedValues[0], 'actual:', vals);
assert.deepEqual(expectedValues.shift(), vals);
},
error(err) {
throw err;
},
complete() {}
});
click$.shamefullySendNext();
$ ./node_modules/.bin/babel-node test.js
expected: [ 0, '0' ] actual: [ 0, '0' ]
expected: [ 1, '1' ] actual: [ 1, '0' ]
AssertionError: [ 1, '1' ] deepEqual [ 1, '0' ]
We expect to see that the count$
and countString$
are equal, but only the count$
increments on click$
.
If you pass countString$
as the first stream to combine, the opposite happens.
This use case is important for @cycle/collection, for combining multiple sinks on each item.
I’m unsure if this is a bug, or if I’m just misunderstanding something fundamental.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Combine streams from Firestore in flutter - Stack Overflow
Use CombineLatestStream from rxdart to combine streams. The StreamBuilder will build every time one of the streams emits a new event.
Read more >Staind - It's Been Awhile (Official Video) - YouTube
The official video for "It's Been Awhile" by Staind from their album ' Break The Cycle' - available now!Pre-order/ stream “It's Been Awhile ......
Read more >Breaking down CI/CD complexity with parent-child and multi ...
With parent-child pipelines we could break the configurations down into two separate tracks by having two separate jobs trigger child ...
Read more >Define a Parent Data Stream - Salesforce Help
Define a parent data stream to determine a connection between two data streams ... On the Connect & Mix tab, click Data Streams...
Read more >Combining 10-Minute Rest Breaks May—or May Not—Be ...
California's nuanced meal and rest break rules have spawned an endless ... that had a practice of combining two daily 10-minute rest breaks...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ntilwalli I can no longer reproduce this issue in the latest version of xstream, so please consider this issue done and dusted. Thanks for your help 😄
@Widdershin I’m not able to replicate the behavior you describe on webpackbin. If you look here (I posted your exact code but removed the assert) you’ll see the second stream does increment (http://www.webpackbin.com/Nk9ZrTGHb). Can you post a bin which demonstrates the odd behavior?