ReactiveX / rxdart

The Reactive Extensions for Dart
http://reactivex.io
Apache License 2.0
3.37k stars 271 forks source link

fix(combineLatest, concat, concatEager, forkJoin): should iterate over `Iterable<Stream>` once #647

Closed hoc081098 closed 2 years ago

hoc081098 commented 2 years ago

Consider example:

Iterable<Stream<int>> ff() sync* {
  print('YIELD 1');
  yield Stream.value(1);
  print('YIELD 2');
  yield Stream.value(2);
  print('YIELD 3');
  yield Stream.value(3);
}

void main() async {
  await ConcatEagerStream(ff()).forEach(print);
}

// Console
YIELD 1
YIELD 1
YIELD 2
YIELD 3
YIELD 1
YIELD 2
YIELD 3
1
2
3

The iterable yielded many times, that is unexpected behavior.

// Expected behavior
YIELD 1
YIELD 3
YIELD 3
1
2
3

This PR will fix combineLatest, concat, concatEager, forkJoin.

codecov-commenter commented 2 years ago

Codecov Report

Merging #647 (843aa43) into master (79c6f68) will increase coverage by 0.14%. The diff coverage is 98.83%.

@@            Coverage Diff             @@
##           master     #647      +/-   ##
==========================================
+ Coverage   93.15%   93.29%   +0.14%     
==========================================
  Files          74       74              
  Lines        2292     2281      -11     
==========================================
- Hits         2135     2128       -7     
+ Misses        157      153       -4