Skip to content

Commit

Permalink
Update to be breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 15, 2023
1 parent eb5626b commit 8a2d7fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .changeset/clever-plants-greet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@urql/core': minor
'@urql/core': major
---

Update `subscriptionExchange` to receive `FetchBody` instead. In the usual usage of `subscriptionExchange` (for instance with `graphql-ws`) you can expect no breaking changes. However, the `key` and `extensions` field has been removed and instead the `forwardSubscription` function receives the full `Operation` as a second argument.
17 changes: 3 additions & 14 deletions packages/core/src/exchanges/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
Exchange,
ExecutionResult,
Operation,
OperationContext,
OperationResult,
} from '../types';

Expand Down Expand Up @@ -61,20 +60,10 @@ export interface ObservableLike<T> {
};
}

/** A more cross-compatible version of the {@link Operation} structure.
*
* @remarks
* When the `subscriptionExchange` was first created, some transports needed a specific shape
* of {@link GraphQLRequest} objects to be passed to them. This is a shim that is as compatible
* with most transports out of the box as possible.
/** A more cross-compatible version of the {@link GraphQLRequest} structure.
* {@link FetchBody} for more details
*/
export interface SubscriptionOperation {
query: string;
variables: Record<string, unknown> | undefined;
key: string;
extensions: Record<string, any>;
context: OperationContext;
}
export type SubscriptionOperation = FetchBody;

/** A subscription forwarding function, which must accept a {@link SubscriptionOperation}.
*
Expand Down

0 comments on commit 8a2d7fd

Please sign in to comment.