danschultz / frappe

A Dart package for functional reactive programming

Home Page:http://pub.dartlang.org/packages/frappe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

calling distinct seems to make stream no longer a broadcast stream

Andersmholmgren opened this issue · comments

e.g.

EventStream _createReloadStream(Property<bool> isActive,
                                Property<bool> isDirty,
                                ControllableEventStream reloadRequestedStream) {
  final aAndD = isActive.and(isDirty).where((b) => b).asStream().distinct();

  aAndD.listen((_) => print('dirty and active')); // prints
  aAndD.listen((_) => print('dirty and active2')); // never printed

 ...

changing aAndD to

  final aAndD = isActive.and(isDirty).where((b) => b).asStream().distinct().asBroadcastStream();

fixes the problem, but surely that shouldn't be required. I can't see a valid use case for FRP with non broadcast streams. And changing from broadcast to non broadcast when calling distinct is not intuitive to me so guessing it is a bug

I have a feeling this is related to #17

Closing. This is a dup of #17.