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(AsyncSubject): properly emits values during reentrant subscriptions #6522

Merged

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Jul 14, 2021

Resolves #6520

@benlesh benlesh added the 7.x Issues and PRs for version 6.x label Jul 14, 2021
@benlesh benlesh requested a review from cartant July 14, 2021 16:32
@@ -211,7 +211,7 @@ describe('AsyncSubject', () => {
expect(calls).to.equal(1);
});

it('should not be reentrant via next', () => {
it('should not be reentrant via next', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to get prettier going on this file. This was just moving a space that was bothering me. haha.

if (hasError) {
subscriber.error(thrownError);
} else if (isStopped) {
} else if (isStopped || _isComplete) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Basically, there's a temporal space where we're _isComplete, but not isStopped while we're nexting to consumers in our complete() method. If someone subscribes during that, we end up hitting this code, and if we're only checking isStopped it's not "stopped" yet, so we didn't notify the consumer.

@benlesh benlesh merged commit dd8bdf3 into ReactiveX:master Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.x Issues and PRs for version 6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression from 6 to 7 with subscribing to a subject from within a next call
2 participants