How can I get rid of the Bluebird warning when combining multiple flatMap statements in RxJS?

This code gives me this error

Warning: a promise was created in a handler but none were returned from it

var Observable = Rx.Observable;

var source = Observable.range(0, 3);

source
  .flatMap(item => {
    console.log('getting first promise');
    return Observable.fromPromise(
      new Promise((resolve, reject) => {
        resolve(5)
      })
    );
  })
  .flatMap(item => {
    console.log('item ==', item);
    console.log('getting second promise');
    return Observable.fromPromise(
      new Promise((resolve, reject) => {
        resolve(4)
      })
    );

  })
  .subscribe(x => console.log('sub1 == ', x));

If you delete the second statement flatMap, I will not get an error. Why does the second RxJS flatMap statement raise a Bluebird warning, but the first FlatMap is missing? And of course, what do I need to fix in the way I use Bluebird Promises?

Here is Plunk , which demonstrates the problem, you will see warnings in the Chrome Developer Console

+4
source share
2 answers

( Promise, , , ), PR Rx .

+1

Source: https://habr.com/ru/post/1623813/


All Articles