Reactables should preserve stream type
danschultz opened this issue · comments
Dan Schultz commented
The following code is throwing a Uncaught Error: Bad state: Stream has already been listened to.
error:
var searchInput = $["search-input"] as TextInputElement;
var onInput = new EventStream(searchInput.onChange)
.debounce(new Duration(microseconds: 250))
.map((_) => searchInput.value)
.distinct();
onInput.forEach((search) => print("searching for $search"));
var suggestions = onInput.flatMapLatest((search) => _queryMovies(search).asStream());
suggestions.forEach((suggestions) => print(suggestions));
Since searchInput.onChange
is a broadcast stream, I'd expect that I'd be able to add multiple listeners to the reactable transformation.
Andersmholmgren commented
FYI I just attempted to upgrade to 0.3.2 but I hit this issue all over the place
Dan Schultz commented
Thanks for the report. I'll tackle this next.
Dan Schultz commented
These issues should be fixed in the v0.4 branch