urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

fix(bindings): Fix handlers for subscriptions receiving null #3581

Closed kitten closed 2 months ago

kitten commented 2 months ago

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

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: e7add6194f752dd830ccc09cc0e9c45097217133

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