All examples By author By category About

skokenes

RxJS 5.5.0-beta.5 issue with mergeMap vs. map + mergeAll

Issue: mergeMap() potentially not working properly in RxJS 5.5.0-beta.5

I have an open source library built on top of RxJS. This library is responsible for handling API requests and responses between a client and a server. The communication between the client and server is via a websocket. The library allows you to make an API call to the server and returns an Observable for the response to the API call.

The library is built using RxJS 5.5.0-beta.5's lettable operators. The library distribution includes a bundled build that can be used in the browser. When the browser bundle is being used, it is likely that someone would be using the RxJS bundled library as well.

In the example posted here, I've mocked up an extremely simple version of the library. The library has an "ask" function that will make a fake API call and return an Observable for the response. In the index.html file, I am simulating using the library with an RxJS bundle. Specifically, I am trying to create a stream of API call responses using mergeMap. The mergeMap operator does not appear to be adding the inner subscriptions. However, if I use map(), mergeAll() instead, the API call response stream works as expected.