Skip to content

delayWhen should use an indefinite delay for notifiers that complete without emitting #3665

@cartant

Description

@cartant

This issue's title has been changed, as the implementation of delayWhen is not correct - see the discussion below.

The original issue's description follows.

RxJS version: 6.1.0

Code to reproduce:

import { EMPTY, of } from "rxjs";
import { delay, delayWhen } from "rxjs/operators";

of(0).pipe(
    delayWhen(() => EMPTY.pipe(delay(0)))
).subscribe(console.log);

Expected behavior:

0 should be emitted and logged to the console.

Actual behavior:

Nothing is emitted and logged to the console.

If the of function is passed 1 instead of 0, 1 is logged to the console.

Additional information:

Looking at delayWhen, I can see another problem (other than #3663) with the implementation. If the value is falsy, and the notifier completes - rather than nexts - the value won't be emitted.

Metadata

Metadata

Assignees

Labels

bugConfirmed bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions