Member-only story
How to dataflow merge on Observable
In this series, I will explore programming techniques for the notebook platform Observable. Today I am looking at how to merge multiple reactive Dataflow streams into a single stream. This article assumes you are familiar with Observable’s non-linear reactive program flow already.
A common situation is this: you have a notebook that performs some useful task, and you want to offer a few different ways to start that task. For example, starting something based on configuration obtained from either URL parameters, local storage, or a manual UI. It’s a little trickier than you would hope because, if each of these methods is in their own cell [1], then we have multiple distinct data flow pathways converging into a single flow.
[1] and they probably should be because of separation-of-concerns

The core difficulty is if there is no data in a source, its dataflow won’t tick, so if the business logic depends on all the input sources, the business logic will not tick either. So this pattern described here will joins the business logic to the sources a different way so that if any of them tick, the business logic will tick too.
In ReactiveX terms, Observable’s dataflow is a combineLatest across cell streams, but we want a merge.