Fixes an issue where a dependent stream is never updated #163
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
as mentioned in #162
The problem is that when dependent streams are created in the context of other streams
updateStream
pushes the streams totoUpdate
if their dependencies are met.flushUpdate
then updates the dependencies of that stream.The problem is
flushUpdate
only works for streams updated withupdateStreamValue
. The dependent streams function is never called influshUpdate
.This would need to happen inside flushUpdate for those streams.
I think the solution lies in changing toUpdate from
List Stream
toList Function
flushUpdate
then calls each function in the array in sequenceupdateStream would then in stead of calling
toUpdate.push(s)
and updateStreamValue would do
This will result in
Meaning the mapped stream is guaranteed to run, but maybe not when you expect it to. Which should be fine since you shouldn't really be interacting with dependent streams synchronously.