-
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
fix(zip): handle when unsubscribe is called from within next #6955
base: master
Are you sure you want to change the base?
Conversation
src/internal/observable/zip.ts
Outdated
@@ -88,7 +88,7 @@ export function zip(...args: unknown[]): Observable<unknown> { | |||
// If any one of the sources is both complete and has an empty buffer | |||
// then we complete the result. This is because we cannot possibly have | |||
// any more values to zip together. | |||
if (buffers.some((buffer, i) => !buffer.length && completed[i])) { | |||
if (buffers !== null && buffers.some((buffer, i) => !buffer.length && completed[i])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
if (buffers !== null && buffers.some((buffer, i) => !buffer.length && completed[i])) { | |
if (buffers?.some((buffer, i) => !buffer.length && completed[i])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially thought using an explicit !== null
check is better as it results in a boolean which some people (including myself :-)) prefer. But I think your suggestion is more in line with the existing RxJS codebase.
I've changed it. Thanks for the review.
a26936f
to
b1917c2
Compare
Sorry for tagging you @benlesh. I know it sucks. But given that this PR already had it's first anniversary and I rebased it a couple of times I hope it's okay. I would really appreciate if you could take a look. The PR only adds a single character and a test. Many thanks in advance. |
I just faced this issue in my code too and it would be great to have the PR merged 😉 |
Description:
This PR makes sure the error reported here (#6716) doesn't get thrown anymore.
BREAKING CHANGE: There are no breaking changes.
Related issue (if exists): #6716
I've added a test case which covers the bug but I wasn't sure if there might be a better way to test this. Please let me know if I need to change anything.