Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(delayWhen): no longer emits if duration selector is empty #5769

Merged

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Sep 29, 2020

  • Resolves an issue where a duration selector that never emitted a value would cause the value to be emitted, even though there wasn't a "notification".
  • delayWhen is now based on mergeMap. I started off with trying to use mergeInternals, but quickly realized it was doing the same thing as mergeMap, and I could just use that directly.

I'm not sure if this size optimization is "taking it too far", but I feel that delayWhen isn't exactly "hot path" code, so this optimization is fine, IMO, given the bundle savings it should yield.

@benlesh benlesh force-pushed the fix/delayWhen-no-emit-on-empty-selector branch from 18f757e to 85446f2 Compare September 29, 2020 13:41
@niklas-wortmann
Copy link
Member

I am not sure if this is really a fix. I mean I get your point, but we had a test for the behavior when the delaySelector just completes. This could break people, right?

@benlesh
Copy link
Member Author

benlesh commented Oct 7, 2020

This will resolve #3665.

@benlesh
Copy link
Member Author

benlesh commented Oct 7, 2020

@niklas-wortmann Yes, this is a fix, which would be a breaking change, but it's still a bug fix and we want to get it into v7.

- Resolves an issue where a duration selector that never emitted a value would cause the value to be emitted, even though there wasn't a "notification".
- `delayWhen` is now based on `mergeMap`. I started off with trying to use `mergeInternals`, but quickly realized it was doing the same thing as `mergeMap`, and I could just use that directly.

I'm not sure if this size optimization is "taking it too far", but I feel that `delayWhen` isn't exactly "hot path" code, so this optimization is fine, given the bundle savings it should yield.

BREAKING CHANGE: `delayWhen` will no longer emit if the duration selector simply completes without a value. Notifiers must notify with a value, not a completion.

fixes ReactiveX#3665
@benlesh benlesh force-pushed the fix/delayWhen-no-emit-on-empty-selector branch from 85446f2 to 611987d Compare October 7, 2020 21:35
@benlesh
Copy link
Member Author

benlesh commented Oct 7, 2020

Updated commit message.

@benlesh benlesh requested a review from cartant October 7, 2020 21:35
@benlesh benlesh mentioned this pull request Oct 7, 2020
13 tasks
@benlesh benlesh merged commit 0872341 into ReactiveX:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants