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(bindings): Fix handlers for subscriptions receiving null #3581

Merged
merged 1 commit into from
May 3, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented May 3, 2024

Summary

Note

Reported on Discord

The subscription handlers infer their new value argument type as T of OperationResult<T>. This means that data: null cases are uncovered and the handler may accidentally receive null values when the types specify that this isn't possible.

This may happen when a trailing value of a subscription contains a fatal error rather than a result value.

In this case it should be safe to ignore the value, since the subscription will either be restarted by the subscription client (or a retryExchange), or will terminate.

Set of changes

  • Handle null values before passing result.data to subscription handlers

@kitten kitten requested a review from JoviDeCroock May 3, 2024 10:41
Copy link

changeset-bot bot commented May 3, 2024

🦋 Changeset detected

Latest commit: e7add61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@urql/preact Patch
@urql/svelte Patch
urql Patch
@urql/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten merged commit 9272cef into main May 3, 2024
13 checks passed
@kitten kitten deleted the fix/subscription-error-bindings branch May 3, 2024 10:45
@github-actions github-actions bot mentioned this pull request May 3, 2024
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.

None yet

2 participants