From 0abde20980987b03d9b31f9387dcd4f64a57dbaa Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Fri, 27 Jul 2018 20:56:11 -0400 Subject: [PATCH 1/2] Fixed broken `DataProxy` link Updated `README` link to point to the `DataProxy.ts` file in `apollo-cache`. I've also updated left over `dev.apollodata.com` links I noticed while tracing this issue in the docs. Fixes #3726. --- docs/source/api/react-apollo.md | 2 +- docs/source/basics/queries.md | 4 ++-- packages/apollo-cache-inmemory/README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/api/react-apollo.md b/docs/source/api/react-apollo.md index 11e897301cc..331c4f5a937 100644 --- a/docs/source/api/react-apollo.md +++ b/docs/source/api/react-apollo.md @@ -696,7 +696,7 @@ data.fetchMore({

`data.subscribeToMore(options)`

-This function will set up a subscription, triggering updates whenever the server sends a subscription publication. This requires subscriptions to be set up on the server to properly work. Check out the [subscriptions guide](http://dev.apollodata.com/react/receiving-updates.html#Subscriptions) and the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) and [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) for more information on getting this set up. +This function will set up a subscription, triggering updates whenever the server sends a subscription publication. This requires subscriptions to be set up on the server to properly work. Check out the [subscriptions guide](../advanced/caching.html#Subscriptions) and the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) and [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) for more information on getting this set up. This function returns an `unsubscribe` function handler which can be used to unsubscribe later. diff --git a/docs/source/basics/queries.md b/docs/source/basics/queries.md index 8f4f7d5c6af..d687ddaf289 100644 --- a/docs/source/basics/queries.md +++ b/docs/source/basics/queries.md @@ -425,7 +425,7 @@ data.fetchMore({

`data.subscribeToMore(options)`

-This function will set up a subscription, triggering updates whenever the server sends a subscription publication. This requires subscriptions to be set up on the server to properly work. Check out the [subscriptions guide](http://dev.apollodata.com/react/receiving-updates.html#Subscriptions) and the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) and [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) for more information on getting this set up. +This function will set up a subscription, triggering updates whenever the server sends a subscription publication. This requires subscriptions to be set up on the server to properly work. Check out the [subscriptions guide](../advanced/caching.html#Subscriptions) and the [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws) and [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) for more information on getting this set up. This function returns an `unsubscribe` function handler which can be used to unsubscribe later. @@ -433,7 +433,7 @@ A common practice is to wrap the `subscribeToMore` call within `componentWillRec - `[document]`: Document is a required property that accepts a GraphQL subscription created with `graphql-tag`’s `gql` template string tag. It should contain a single GraphQL subscription operation with the data that will be returned. - `[variables]`: The optional variables you may provide that will be used with the `document` option. -- `[updateQuery]`: An optional function that runs every time the server sends an update. This modifies the results of the HOC query. The first argument, `previousResult`, will be the previous data returned by the query you defined in your `graphql()` function. The second argument is an object with two properties. `subscriptionData` is result of the subscription. `variables` is the variables object used with the subscription query. Using these arguments you should return a new data object with the same shape as the GraphQL query you defined in your `graphql()` function. This is similar to the [`fetchMore`](#graphql-query-data-fetchMore) callback. Alternatively, you could update the query using a [reducer](http://dev.apollodata.com/react/cache-updates.html#resultReducers) as part of the [options](http://dev.apollodata.com/react/queries.html#graphql-options) of your `graphql()` function. +- `[updateQuery]`: An optional function that runs every time the server sends an update. This modifies the results of the HOC query. The first argument, `previousResult`, will be the previous data returned by the query you defined in your `graphql()` function. The second argument is an object with two properties. `subscriptionData` is result of the subscription. `variables` is the variables object used with the subscription query. Using these arguments you should return a new data object with the same shape as the GraphQL query you defined in your `graphql()` function. This is similar to the [`fetchMore`](#graphql-query-data-fetchMore) callback. Alternatively, you could update the query using a [reducer](../advanced/caching.html#resultReducers) as part of the [options](../essentials/queries.html#graphql-options) of your `graphql()` function. - `[onError]`: An optional error callback. In order to update the query's store with the result of the subscription, you must specify either the `updateQuery` option in `subscribeToMore` or the `reducer` option in your `graphql()` function. diff --git a/packages/apollo-cache-inmemory/README.md b/packages/apollo-cache-inmemory/README.md index 4d8944521fc..f0ed8517cc6 100644 --- a/packages/apollo-cache-inmemory/README.md +++ b/packages/apollo-cache-inmemory/README.md @@ -68,7 +68,7 @@ const cache = new InMemoryCache({

Direct Cache Access

-To interact directly with your cache, you can use the Apollo Client class methods readQuery, readFragment, writeQuery, and writeFragment. These methods are available to us via the [`DataProxy` interface](http://dev.apollodata.com/core/apollo-client-api.html#DataProxy). Accessing these methods will vary slightly based on your view layer implementation. If you are using React, you can wrap your component in the `withApollo` higher order component, which will give you access to `this.props.client`. From there, you can use the methods to control your data. +To interact directly with your cache, you can use the Apollo Client class methods readQuery, readFragment, writeQuery, and writeFragment. These methods are available to us via the [`DataProxy` interface](https://github.com/apollographql/apollo-client/blob/master/packages/apollo-cache/src/types/DataProxy.ts). Accessing these methods will vary slightly based on your view layer implementation. If you are using React, you can wrap your component in the `withApollo` higher order component, which will give you access to `this.props.client`. From there, you can use the methods to control your data. Any code demonstration in the following sections will assume that we have already initialized an instance of `ApolloClient` and that we have imported the `gql` tag from `graphql-tag`. From e508020dbed1bf6817bf44d946862e3b82bcca30 Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Fri, 27 Jul 2018 21:00:41 -0400 Subject: [PATCH 2/2] Changelog update --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0d9101d29..d1e8b31e553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ seen using `graphql` 0.12.x or 0.13.x.
[@hwillson](https://github.com/hwillson) in [#3746](https://github.com/apollographql/apollo-client/pull/3746) - Documentation updates.
- [@hwillson](https://github.com/hwillson) in [#3750](https://github.com/apollographql/apollo-client/pull/3750) + [@hwillson](https://github.com/hwillson) in [#3750](https://github.com/apollographql/apollo-client/pull/3750)
+ [@hwillson](https://github.com/hwillson) in [#3754](https://github.com/apollographql/apollo-client/pull/3754) ## 2.3.7 (July 24, 2018)