expand takes a concurrent parameter — with which you can limit the number of concurrent inner observables. Specifying 1 would limit the number of concurrent requests to the depth of your tree — i.e. one country at a time, one state at a time, etc.

Presumably, your API calls would be asynchronous, which means we’re talking about a heap limit, here, rather than a stack limit.

expand a pretty flexible operator. You can also use it to control back pressure — so the the countries and states, etc. that you are querying cannot be pushed into a consumer faster than they’re able to be consumed. I have a not-yet-finished article on that subject which I’ll publish soon. Hopefully. I’ve been pretty slack with the writing of articles, lately.

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store