apollo-client v2.6.0 Release Notes

    • In production, invariant(condition, message) failures will now include a unique error code that can be used to trace the error back to the point of failure. @benjamn in #4521

    Apollo Client 2.6.0

    • 🐎 If you can be sure your application code does not modify cache result objects (see freezeResults note below), you can unlock substantial performance improvements by communicating this assumption via

      new ApolloClient({ assumeImmutableResults: true })

      which allows the client to avoid taking defensive snapshots of past results using cloneDeep, as explained by @benjamn in #4543.

    • 📦 Identical overlapping queries are now deduplicated internally by apollo-client, rather than using the apollo-link-dedup package. @benjamn in commit 7cd8479f

    • The FetchPolicy type has been split into two types, so that passing cache-and-network to ApolloClient#query is now forbidden at the type level, whereas previously it was forbidden by a runtime invariant assertion:

      export type FetchPolicy =
      | 'cache-first'
      | 'network-only'
      | 'cache-only'
      | 'no-cache'
      | 'standby';

    export type WatchQueryFetchPolicy = | FetchPolicy | 'cache-and-network';

      The exception thrown if you ignore the type error has also been improved to explain the motivation behind this restriction. <br/>
      [Issue #3130 (comment)](https://github.com/apollographql/apollo-client/issues/3130#issuecomment-478409066) and commit [cf069bc7](github.com/apollographql/apollo-client/commit/cf069bc7ee6577092234b0eb0ac32e05d50f5a1c)
    - ⚡️ Avoid updating (and later invalidating) cache watches when `fetchPolicy` is `'no-cache'`. <br/>
      [@bradleyayers](https://github.com/bradleyayers) in [PR #4573](https://github.com/apollographql/apollo-client/pull/4573), part of [issue #3452](https://github.com/apollographql/apollo-client/issues/3452)
    - ✂ Remove temporary `queryId` after `fetchMore` completes. <br/>
      [@doomsower](https://github.com/doomsower) in [#4440](https://github.com/apollographql/apollo-client/pull/4440)
    - Call `clearStore` callbacks after clearing store. <br/>
      [@ds8k](https://github.com/ds8k) in [#4695](https://github.com/apollographql/apollo-client/pull/4695)
    - Perform all `DocumentNode` transforms once, and cache the results. <br/>
      [@benjamn](https://github.com/benjamn) in [#4601](https://github.com/apollographql/apollo-client/pull/4601)
    - Accommodate `@client @export` variable changes in `ObservableQuery`. <br/>
      [@hwillson](https://github.com/hwillson) in [#4604](https://github.com/apollographql/apollo-client/pull/4604)
    - 👌 Support the `returnPartialData` option for watched queries again. <br/>
      [@benjamn](https://github.com/benjamn) in [#4743](https://github.com/apollographql/apollo-client/pull/4743)
    - Preserve `networkStatus` for incomplete `cache-and-network` queries. <br/>
      [@benjamn](https://github.com/benjamn) in [#4765](https://github.com/apollographql/apollo-client/pull/4765)
    - Preserve `cache-and-network` `fetchPolicy` when refetching. <br/>
      [@benjamn](https://github.com/benjamn) in [#4840](https://github.com/apollographql/apollo-client/pull/4840)
    - ⚡️ Update the React Native docs to remove the request for external example apps that we can link to. We're no longer going to manage a list of external example apps. <br />
      [@hwillson](https://github.com/hwillson) in [#4531](https://github.com/apollographql/apollo-client/pull/4531)
    - ⏱ Polling queries are no longer batched together, so their scheduling should be more predictable. <br/>
      [@benjamn](https://github.com/benjamn) in [#4800](https://github.com/apollographql/apollo-client/pull/4800)
    ### Apollo Cache In-Memory 1.6.0
    - 👌 Support `new InMemoryCache({ freezeResults: true })` to help enforce immutability. <br/>
      [@benjamn](https://github.com/benjamn) in [#4514](https://github.com/apollographql/apollo-client/pull/4514)
    - 👍 Allow `IntrospectionFragmentMatcher` to match fragments against the root `Query`, as `HeuristicFragmentMatcher` does. <br/>
      [@rynobax](https://github.com/rynobax) in [#4620](https://github.com/apollographql/apollo-client/pull/4620)
    - Rerential identity (`===`) of arrays in cache results will now be preserved for unchanged data. <br/>
      [@benjamn](https://github.com/benjamn) in commit [f3091d6a](https://github.com/apollographql/apollo-client/pull/4586/commits/f3091d6a7e91be98549baea58903282cc540f460)
    - Avoid adding `__typename` field to `@client` selection sets that have been `@export`ed as input variables. <br/>
      [@benjamn](https://github.com/benjamn) in [#4784](https://github.com/apollographql/apollo-client/pull/4784)
    ### GraphQL Anywhere 4.2.2
    - 🔧 The `graphql` function can now be configured to ignore `@include` and
      `@skip` directives (useful when walking a fragment to generate prop types
      or filter result data).  <br/>
      [@GreenGremlin](https://github.com/GreenGremlin) in [#4373](https://github.com/apollographql/apollo-client/pull/4373)