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(zip): handle when unsubscribe is called from within next #6955

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisguttandin
Copy link
Contributor

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.

@@ -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])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
if (buffers !== null && buffers.some((buffer, i) => !buffer.length && completed[i])) {
if (buffers?.some((buffer, i) => !buffer.length && completed[i])) {

Copy link
Contributor Author

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.

@chrisguttandin
Copy link
Contributor Author

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.

@truebden
Copy link

truebden commented Jul 2, 2024

I just faced this issue in my code too and it would be great to have the PR merged 😉

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