flyd
flyd copied to clipboard
Fix ending a stream while updating
Fixes #228 which highlighted an edge case that happens when a stream is ended while being processed in very specific circumstances. In those circumstances the end stream will be triggered before the listeners because it's updated is queued before the listener updates.
To solve for this we add a toEnd
array into which the end stream of the current stream will be pushed to if it's updated while while the main stream is updated (that's a convoluted sentence, it's a convoluted data flow, not sure how to communicate this properly)