-
Notifications
You must be signed in to change notification settings - Fork 3k
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
chore(take): test case for error notification after limit is reached #6394
Conversation
The behaviour reported in that issue is a bug. It's supposed to stop listening. IMO, I would deem this a bug fix - pretty much any bug fix could be considered a breaking change - but could be persuaded that it's a break and should go into 8.x. Either way, this has to be fixed. I have this on my of things to do/fix, but you - or anyone else - are welcome to do it. I also have noted that |
Hmm... I just closed that issue as "not a bug". It seems more like a misunderstanding in the order of execution. I'll reopen because I'm interested in other opinions. |
while checking out take, i noticed that it also doesn't handle non-ints very well either. imho, it should either check for |
@backbone87 ... probably a separate issue to address. I do have a fix for take, though. Let's add a |
d1c9add
to
9f70be6
Compare
ah we pushed at the same time fwiw here is the fixed I prepared locally: const connection = new OperatorSubscriber<T>(subscriber, (value) => {
if (++seen === count) {
// unsubscribe from the source if we have taken enough after the current
// value. needs to be done before notifying downstream, so we dont get
// any more notifications from upstream through sync recursion
connection.unsubscribe();
subscriber.next(value);
subscriber.complete();
} else if (seen < count) {
subscriber.next(value);
}
});
source.subscribe(connection); though this causes a whitebox test for delayWhen to fail |
Probably want to remove the breaking change label from the description if this is gonna be merged as just a test. Also, the reason I deem this a bug is because the operator is knowingly letting stuff - side effects - happen when it could immediately unsubscribe. And, FWIW, the fix I was gonna make was basically what's ☝ |
feel free to edit around the PR & branch, I wont push anymore now to avoid any more conflicts since @benlesh is working on it |
@cartant yeah, we're already handling reentrancy in the |
Thanks for this, @backbone87, very helpful! |
Now that you're a contributor, @backbone87, I don't have to approve CI runs on your PRs. 🎉 |
Follow up PR is here: #6396 |
Description:
provides a failing test case for an edge case of take and dependent operators as presented in #5487
Will add a fix, if a change in behavior is agreed upon.
Related issue (if exists): fixes #5487