'Using Delay within ConcatMap, Observable only emits once

Given the following code:

range(1, 30)
  .pipe(
    windowCount(10),
    concatMap(x => x.pipe(delay(5000))),
  )
  .subscribe(console.log);

For some reason only the first value is emitted (1..10), could anyone please point out what's wrong with the above code? Thanks.

expected output: 1..10 (delay) 11..20 (delay) and so on....



Solution 1:[1]

I ended up using bufferCount and expected output is achieved.

range(1, 30)
  .pipe(
    bufferCount(10),
    concatMap(x => x.pipe(delay(5000))),
  )
  .subscribe(console.log);

DEMO

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1