Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hwillson authored Jul 16, 2018
2 parents 6d6a27b + 5e6819d commit 5555a4f
Show file tree
Hide file tree
Showing 31 changed files with 389 additions and 123 deletions.
9 changes: 4 additions & 5 deletions .github/ISSUE_REPLY_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ To make things easier for you and for a maintiner or contributor to help out, he
If this is your first time contributing to Apollo, one of our friendly bots will ask for you to sign the CLA. After that, take a look at the [contributor guide](https://github.com/apollographql/apollo-client/blob/master/CONTRIBUTING.md)!

### Creating a reproduction:
- You can create a reproduction using [this template](https://codesandbox.io/s/7361K9q6w) on codesandbox, or try it locally using [the apollo error template](https://github.com/apollographql/react-apollo-error-template)
- If you want to customize the schema to match the issue you are having, checkout [Apollo Launchpad](https://launchpad.graphql.com/new)
- If your issue is related to react-native, try using [Expo](https://snack.expo.io/)
- You can create a reproduction using [this template](https://codesandbox.io/s/7361K9q6w) on codesandbox, or try it locally using [the apollo error template](https://github.com/apollographql/react-apollo-error-template).
- If you want to customize the schema to match the issue you are having, checkout [Apollo Launchpad](https://launchpad.graphql.com/new).
- If your issue is related to react-native, try using [Expo](https://snack.expo.io/).

### Guides and Documentation
The issue you are having (or the feature you are requesting) may already be fixed! To find the latest information about how to use Apollo, check out the [documentation](http://dev.apollodata.com/) and see the latest entry from [the blog](https://dev-blog.apollodata.com)

The issue you are having (or the feature you are requesting) may already be fixed! To find the latest information about how to use Apollo, check out the [documentation](http://www.apollographql.com/docs/) and see the latest posts from [the Apollo GraphQL blog](https://blog.apollographql.com/).

Thank you again for helping to improve Apollo Client!
157 changes: 91 additions & 66 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
**Note:** This is a cumulative changelog that outlines all of the Apollo Client project child package changes that were bundled into a specific `apollo-client` release.

## vNext

### Apollo Client (vNext)

- Documentation updates.
[@ananth99](https://github.com/ananth99) in [#3599](https://github.com/apollographql/apollo-client/pull/3599)
[@hwillson](https://github.com/hwillson) in [#3635](https://github.com/apollographql/apollo-client/pull/3635)
[@JakeDawkins](https://github.com/JakeDawkins) in [#3642](https://github.com/apollographql/apollo-client/pull/3642)
[@hwillson](https://github.com/hwillson) in [#3644](https://github.com/apollographql/apollo-client/pull/3644)
[@gbau](https://github.com/gbau) in [#3644](https://github.com/apollographql/apollo-client/pull/3600)
[@chentsulin](https://github.com/chentsulin) in [#3608](https://github.com/apollographql/apollo-client/pull/3608)
[@MikaelCarpenter](https://github.com/MikaelCarpenter) in [#3609](https://github.com/apollographql/apollo-client/pull/3609)
- Updated `graphql` `peerDependencies` to handle 14.x versions.
[@ivank](https://github.com/ivank) in [#3598](https://github.com/apollographql/apollo-client/pull/3598)

### Apollo Boost (vNext)

- Allow `fetch` to be given as a configuration option to `ApolloBoost`.
[@mbaranovski](https://github.com/mbaranovski) in [#3590](https://github.com/apollographql/apollo-client/pull/3590)

### Apollo GraphQL Anywhere (vNext)

- Add support for arrays to `graphql-anywhere`'s filter utility.
[@jsweet314](https://github.com/jsweet314) in [#3591](https://github.com/apollographql/apollo-client/pull/3591)

## 2.3.5 (June 19, 2018)

### Apollo Client (2.3.5)
Expand Down Expand Up @@ -90,83 +115,83 @@
- Allow `headers` and `credentials` to be passed in as configuration
parameters to the `apollo-boost` `ApolloClient` constructor.
([@rzane](https://github.com/rzane) in [#3098](https://github.com/apollographql/apollo-client/pull/3098))

### Apollo Cache (1.1.10)

- Added optional generics to cache manipulation methods (typescript).

### Apollo Cache (1.1.10)

- Added optional generics to cache manipulation methods (typescript).
([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541))


### Apollo Cache In-Memory (1.2.3)

- Added optional generics to cache manipulation methods (typescript).
([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541))
- Restore non-enumerability of `resultFields[ID_KEY]`.
([@benjamn](https://github.com/benjamn) in [#3544](https://github.com/apollographql/apollo-client/pull/3544))
- Cache query documents transformed by InMemoryCache.
([@benjamn](https://github.com/benjamn) in [#3553](https://github.com/apollographql/apollo-client/pull/3553))

### Apollo Utilities (1.0.14)

- Store key names generated by `getStoreKeyName` now leverage a more
deterministic approach to handling JSON based strings. This prevents store
key names from differing when using `args` like
`{ prop1: 'value1', prop2: 'value2' }` and
`{ prop2: 'value2', prop1: 'value1' }`.
([@gdi2290](https://github.com/gdi2290) in [#2869](https://github.com/apollographql/apollo-client/pull/2869))
- Avoid needless `hasOwnProperty` check in `deepFreeze`.
([@benjamn](https://github.com/benjamn) in [#3545](https://github.com/apollographql/apollo-client/pull/3545))

### Apollo GraphQL Anywhere (4.1.12)

- No new changes.


## 2.3.2 (May 29, 2018)

### Apollo Client (2.3.2)

- Fix SSR and `cache-and-network` fetch policy
([@dastoori](https://github.com/dastoori) in [#3372](https://github.com/apollographql/apollo-client/pull/3372))
- Fixed an issue where the `updateQuery` method passed to
`ObservableQuery.fetchMore` was receiving the original query variables,
instead of the new variables that it used to fetch more data.
([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3500](https://github.com/apollographql/apollo-client/pull/3500))
- Fixed an issue involving `Object.setPrototypeOf()` not working on JSC
(Android), by instead setting the `prototype` of `this` manually.
([@seklyza](https://github.com/seklyza) in [#3306](https://github.com/apollographql/apollo-client/pull/3306))
- Added safeguards to make sure `QueryStore.initQuery` and
`QueryStore.markQueryResult` don't try to set the network status of a
`fetchMoreForQueryId` query, if it does not exist in the store. This was
happening when a query component was unmounted while a `fetchMore` was still
in flight.
([@conrad-vanl](https://github.com/conrad-vanl) in [#3367](https://github.com/apollographql/apollo-client/pull/3367), [@doomsower](https://github.com/doomsower) in [#3469](https://github.com/apollographql/apollo-client/pull/3469))

### Apollo Boost (0.1.7)

- Various internal code cleanup, tooling and dependency changes.

### Apollo Cache (1.1.9)

- Various internal code cleanup, tooling and dependency changes.

([@benjamn](https://github.com/benjamn) in [#3553](https://github.com/apollographql/apollo-client/pull/3553))

### Apollo Utilities (1.0.14)

- Store key names generated by `getStoreKeyName` now leverage a more
deterministic approach to handling JSON based strings. This prevents store
key names from differing when using `args` like
`{ prop1: 'value1', prop2: 'value2' }` and
`{ prop2: 'value2', prop1: 'value1' }`.
([@gdi2290](https://github.com/gdi2290) in [#2869](https://github.com/apollographql/apollo-client/pull/2869))
- Avoid needless `hasOwnProperty` check in `deepFreeze`.
([@benjamn](https://github.com/benjamn) in [#3545](https://github.com/apollographql/apollo-client/pull/3545))

### Apollo GraphQL Anywhere (4.1.12)

- No new changes.


## 2.3.2 (May 29, 2018)

### Apollo Client (2.3.2)

- Fix SSR and `cache-and-network` fetch policy
([@dastoori](https://github.com/dastoori) in [#3372](https://github.com/apollographql/apollo-client/pull/3372))
- Fixed an issue where the `updateQuery` method passed to
`ObservableQuery.fetchMore` was receiving the original query variables,
instead of the new variables that it used to fetch more data.
([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3500](https://github.com/apollographql/apollo-client/pull/3500))
- Fixed an issue involving `Object.setPrototypeOf()` not working on JSC
(Android), by instead setting the `prototype` of `this` manually.
([@seklyza](https://github.com/seklyza) in [#3306](https://github.com/apollographql/apollo-client/pull/3306))
- Added safeguards to make sure `QueryStore.initQuery` and
`QueryStore.markQueryResult` don't try to set the network status of a
`fetchMoreForQueryId` query, if it does not exist in the store. This was
happening when a query component was unmounted while a `fetchMore` was still
in flight.
([@conrad-vanl](https://github.com/conrad-vanl) in [#3367](https://github.com/apollographql/apollo-client/pull/3367), [@doomsower](https://github.com/doomsower) in [#3469](https://github.com/apollographql/apollo-client/pull/3469))

### Apollo Boost (0.1.7)

- Various internal code cleanup, tooling and dependency changes.

### Apollo Cache (1.1.9)

- Various internal code cleanup, tooling and dependency changes.

### Apollo Cache In-Memory (1.2.2)

- Fixed an issue that caused fragment only queries to sometimes fail.
([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3507](https://github.com/apollographql/apollo-client/pull/3507))
- Fixed cache invalidation for inlined mixed types in union fields within
arrays.
([@dferber90](https://github.com/dferber90) in [#3422](https://github.com/apollographql/apollo-client/pull/3422))

### Apollo Utilities (1.0.13)

- Make `maybeDeepFreeze` a little more defensive, by always using
`Object.prototype.hasOwnProperty` (to avoid cases where the object being
frozen doesn't have its own `hasOwnProperty`).
([@jorisroling](https://github.com/jorisroling) in [#3418](https://github.com/apollographql/apollo-client/pull/3418))
- Remove certain small internal caches to prevent memory leaks when using SSR.
([@brunorzn](https://github.com/brunorzn) in [#3444](https://github.com/apollographql/apollo-client/pull/3444))

### Apollo GraphQL Anywhere (4.1.11)

- Source files are now excluded when publishing to npm.
([@hwillson](https://github.com/hwillson) in [#3454](https://github.com/apollographql/apollo-client/pull/3454))
([@dferber90](https://github.com/dferber90) in [#3422](https://github.com/apollographql/apollo-client/pull/3422))

### Apollo Utilities (1.0.13)

- Make `maybeDeepFreeze` a little more defensive, by always using
`Object.prototype.hasOwnProperty` (to avoid cases where the object being
frozen doesn't have its own `hasOwnProperty`).
([@jorisroling](https://github.com/jorisroling) in [#3418](https://github.com/apollographql/apollo-client/pull/3418))
- Remove certain small internal caches to prevent memory leaks when using SSR.
([@brunorzn](https://github.com/brunorzn) in [#3444](https://github.com/apollographql/apollo-client/pull/3444))

### Apollo GraphQL Anywhere (4.1.11)

- Source files are now excluded when publishing to npm.
([@hwillson](https://github.com/hwillson) in [#3454](https://github.com/apollographql/apollo-client/pull/3454))
11 changes: 11 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ sidebar_categories:
- recipes/webpack
- recipes/meteor
- recipes/recompose
Related Guides:
- title: State Management
href: https://www.apollographql.com/docs/guides/state-mgmt.html
- title: Testing React Components
href: https://www.apollographql.com/docs/guides/testing-react-components.html
- title: Schema Design
href: https://www.apollographql.com/docs/guides/schema-design.html
API:
- api/apollo-client
- api/react-apollo
Expand All @@ -65,3 +72,7 @@ redirects:
docs/react/api/react-apollo.html#graphql-mutation-options
/docs/react/recipes/simple-example.html:
docs/react/essentials/get-started.html
/docs/react/api/apollo-client.html#FetchPolicy:
docs/react/api/react-apollo.html#graphql-config-options-fetchPolicy
/docs/react/api/apollo-client.html#ErrorPolicy:
docs/react/api/react-apollo.html#graphql-config-options-errorPolicy
7 changes: 4 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
"version": "3.7.1"
},
"devDependencies": {
"apollo-hexo-config": "1.0.7",
"apollo-hexo-config": "1.0.8",
"chexo": "1.0.5",
"hexo": "3.7.1",
"hexo-browsersync": "0.3.0",
"hexo-prism-plus": "1.0.0",
"hexo-renderer-ejs": "0.3.1",
"hexo-renderer-less": "0.2.0",
"hexo-renderer-marked": "0.3.2",
"hexo-server": "0.3.2",
"hexo-typescript-api-box": "0.9.2",
"meteor-theme-hexo": "1.0.16",
"poke-site": "1.3.1",
"start-server-and-test": "1.5.0",
"meteor-theme-hexo": "1.0.15",
"typedoc": "0.9.0",
"typescript": "2.8.3"
"typescript": "2.9.2"
},
"scripts": {
"start": "npm run build && chexo apollo-hexo-config -- server",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/advanced/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The `InMemoryCache` constructor takes an optional config object with properties
- `addTypename`: A boolean to determine whether to add __typename to the document (default: `true`)
- `dataIdFromObject`: A function that takes a data object and returns a unique identifier to be used when normalizing the data in the store. Learn more about how to customize `dataIdFromObject` in the [Normalization](#normalization) section.
- `fragmentMatcher`: By default, the `InMemoryCache` uses a heuristic fragment matcher. If you are using fragments on unions and interfaces, you will need to use an `IntrospectionFragmentMatcher`. For more information, please read [our guide to setting up fragment matching for unions & interfaces](./fragments.html#fragment-matcher).
- `cacheRedirects` (previously known as `cacheResolvers` or `customResolvers`): An map of functions to redirect a query to another entry in the cache before a request takes place. This is useful if you have a list of items and want to use the data from the list query on a detail page where you're querying an individual item. More on that [here](https://www.apollographql.com/docs/react/advanced/caching.html#cacheRedirect).
- `cacheRedirects` (previously known as `cacheResolvers` or `customResolvers`): A map of functions to redirect a query to another entry in the cache before a request takes place. This is useful if you have a list of items and want to use the data from the list query on a detail page where you're querying an individual item. More on that [here](https://www.apollographql.com/docs/react/advanced/caching.html#cacheRedirect).

<h3 id="normalization">Normalization</h3>

Expand Down
3 changes: 3 additions & 0 deletions docs/source/api/apollo-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The `ApolloClient` class is the core API for Apollo, and the one you'll need to
{% tsapibox ApolloClient.watchQuery %}
{% tsapibox ApolloClient.query %}
{% tsapibox ApolloClient.mutate %}
{% tsapibox ApolloClient.subscribe %}
{% tsapibox ApolloClient.readQuery %}
{% tsapibox ApolloClient.readFragment %}
{% tsapibox ApolloClient.writeQuery %}
Expand All @@ -49,6 +50,8 @@ The `ApolloClient` class is the core API for Apollo, and the one you'll need to

<h2 id="ObservableQuery">ObservableQuery</h2>

`ApolloClient` Observables extend the Observables implementation provided by [`zen-observable`](https://github.com/zenparsing/zen-observable). Refer to the `zen-observable` documentation for additional context and API options.

{% tsapibox ObservableQuery.variables %}
{% tsapibox ObservableQuery.result %}
{% tsapibox ObservableQuery.currentResult %}
Expand Down
12 changes: 11 additions & 1 deletion docs/source/api/react-apollo.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ The Query component accepts the following props. Only `query` and `children` are
<dd>The name of your component to be displayed in React DevTools. Defaults to 'Query'.</dd>
<dt>`skip`: boolean</dt>
<dd>If skip is true, the query will be skipped entirely.</dd>
<dt>`onCompleted`: (data: TData | {}) => void</dt>
<dd>A callback executed once your query successfully completes.</dd>
<dt>`onError`: (error: ApolloError) => void</dt>
<dd>A callback executed in the event of an error.</dd>
<dt>`context`: Record<string, any></dt>
<dd>Shared context between your Query component and your network interface (Apollo Link). Useful for setting headers from props or sending information to the `request` function of Apollo Boost.</dd>
</dl>
Expand Down Expand Up @@ -1086,14 +1090,20 @@ export default graphql(gql`

This option allows you to update your store based on your mutation’s result. By default Apollo Client will update all of the overlapping nodes in your store. Anything that shares the same id as returned by the `dataIdFromObject` you defined will be updated with the new fields from your mutation results. However, sometimes this alone is not sufficient. Sometimes you may want to update your cache in a way that is dependent on the data currently in your cache. For these updates you may use an `options.update` function.

`options.update` takes two arguments. The first is an instance of a [`DataProxy`][] object which has some methods which will allow you to interact with the data in your store. The second is the response from your mutation - either the optimistic response, or the actual response returned by your server.
`options.update` takes two arguments. The first is an instance of a [`DataProxy`][] object which has some methods which will allow you to interact with the data in your store. The second is the response from your mutation - either the optimistic response, or the actual response returned by your server (see the mutation result described in the [mutation render prop](./react-apollo.html#mutation-render-prop) section for more details).

In order to change the data in your store call methods on your [`DataProxy`][] instance like [`writeQuery`][] and [`writeFragment`][]. This will update your cache and reactively re-render any of your GraphQL components which are querying affected data.

To read the data from the store that you are changing, make sure to use methods on your [`DataProxy`][] like [`readQuery`][] and [`readFragment`][].

For more information on updating your cache after a mutation with the `options.update` function make sure to read the [Apollo Client technical documentation on the subject](../advanced/caching.html#updating-the-cache-after-a-mutation).

[`DataProxy`]: ../advanced/caching.html#direct
[`writeQuery`]: ../advanced/caching.html#writequery-and-writefragment
[`writeFragment`]: ../advanced/caching.html#writequery-and-writefragment
[`readQuery`]: ../advanced/caching.html#readquery
[`readFragment`]: ../advanced/caching.html#readfragment

**Example:**

```js
Expand Down
2 changes: 2 additions & 0 deletions docs/source/essentials/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Here are the options you can pass to the `ApolloClient` exported from `apollo-bo
<dd>Is set to `same-origin` by default. This option can be used to indicate whether the user agent should send cookies with requests. See [Request.credentials](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials) for more details.</dd>
<dt>`headers`: Object</dt>
<dd>Header key/value pairs to pass along with the request.</dd>
<dt>`fetch`: GlobalFetch['fetch']</dt>
<dd>A [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) compatible API for making a request.</dd>
</dl>
<h2 id="next-steps">Next steps</h2>
Expand Down
Loading

0 comments on commit 5555a4f

Please sign in to comment.