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(distinctUntilChanged): Ensure reentrant code is compared properly #6014

Merged

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Feb 10, 2021

  • Fixes an issue where reentrant code would not be compared properly against previous emissions
  • Adds better code comments
  • Updates documentation with better text and examples

Related to #6013

- Fixes an issue where reentrant code would not be compared properly against previous emissions
- Adds better code comments
- Updates documentation with better text and examples
@benlesh benlesh requested a review from cartant February 10, 2021 19:00
subscriber.next(value);
}
prev = key;
first = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can't happen after we next, it has to happen before. Otherwise the added test will fail.

// We've been allowing `null` do be passed as the `compare`, so we can't do
// a default value for the parameter, because that will only work
// for `undefined`.
comparator = comparator ?? defaultCompare;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this comment, because I tried to use a default value parameter here and it was sad. We should probably deprecate this sort of thing at some point, and make this a configuration object, I suppose.

@benlesh benlesh merged commit 0ebcf17 into ReactiveX:master Feb 11, 2021
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.

2 participants