Skip to content

Commit

Permalink
Update docs on subscription options with the new callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Sep 27, 2022
1 parent 9557391 commit 0e31837
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/shared/subscription-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
| `subscription` | DocumentNode | A GraphQL subscription document parsed into an AST by `graphql-tag`. **Optional** for the `useSubscription` Hook since the subscription can be passed in as the first parameter to the Hook. **Required** for the `Subscription` component. |
| `variables` | { [key: string]: any } | An object containing all of the variables your subscription needs to execute |
| `shouldResubscribe` | boolean | Determines if your subscription should be unsubscribed and subscribed again |
| `onSubscriptionData` | (options: OnSubscriptionDataOptions<TData>) => any | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. |
| `onSubscriptionData` | **Deprecated.** (options: OnSubscriptionDataOptions<TData>) => any | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `subscriptionData`. |
| `onData` | (options: OnDataOptions<TData>) => any | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`. |
| `onSubscriptionComplete` | **Deprecated.** () => void | Allows the registration of a callback function, that will be triggered when the `useSubscription` Hook / `Subscription` component completes the subscription. |
| `onComplete` | () => void | Allows the registration of a callback function, that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription. |
| `fetchPolicy` | FetchPolicy | How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](/react/data/queries/#setting-a-fetch-policy). |
| `context` | Record<string, any> | Shared context between your component and your network interface (Apollo Link). |
| `client` | ApolloClient | An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in. |

0 comments on commit 0e31837

Please sign in to comment.