Skip to content

Releases: apollographql/apollo-client

3.1.0

28 Jul 16:17
824bbe7
Compare
Choose a tag to compare

Apollo Client 3.1.0

Bug Fixes

  • Rework interdependencies between @apollo/client/* entry points, so that CommonJS and ESM modules are supported equally well, without any duplication of shared code.
    @benjamn in #6656 and #6657

  • Tolerate !== callback functions (like onCompleted and onError) in useQuery options, since those functions are almost always freshly evaluated each time useQuery is called.
    @hwillson and @benjamn in #6588

  • Respect context.queryDeduplication if provided, and otherwise fall back to client.deduplication (as before).
    @igaloly in #6261 and @Kujawadl in #6526

  • Refactor ObservableQuery#getCurrentResult to reenable immediate delivery of warm cache results. As part of this refactoring, the ApolloCurrentQueryResult type was eliminated in favor of ApolloQueryResult.
    @benjamn in #6710

  • Avoid clobbering defaultOptions with undefined values.
    @benjamn in #6715

Improvements

  • Apollo Client will no longer modify options.fetchPolicy unless you pass options.nextFetchPolicy to request an explicit change in FetchPolicy after the current request. Although this is technically a breaking change, options.nextFieldPolicy makes it easy to restore the old behavior (by passing cache-first).
    @benjamn in #6712, reverting #6353

  • Errors of the form Invariant Violation: 42 thrown in production can now be looked up much more easily, by consulting the auto-generated @apollo/client/invariantErrorCodes.js file specific to your @apollo/client version.
    @benjamn in #6665

  • Make the client field of the MutationResult type non-optional, since it is always provided.
    @glasser in #6617

  • Allow passing an asynchronous options.renderFunction to getMarkupFromTree.
    @richardscarrott in #6576

  • Ergonomic improvements for merge and keyArgs functions in cache field policies.
    @benjamn in #6714

Apollo Client 3.0.2

Bug Fixes

  • Avoid duplicating graphql/execution/execute dependency in CommonJS bundle for @apollo/client/link/schema, fixing instanceof errors reported in #6621 and #6614.
    @benjamn in #6624

Apollo Client 3.0.1

Bug Fixes

  • Make sure useQuery onCompleted is not fired when skip is true.
    @hwillson in #6589

  • Revert changes to peerDependencies in package.json (#6594), which would have allowed using incompatible future versions of graphql and/or react due to overly-permissive >= version constraints.
    @hwillson in #6605

3.0.0

14 Jul 16:15
5130409
Compare
Choose a tag to compare

Apollo Client 3.0.0

Improvements

⚠️ Note: As of 3.0.0, Apollo Client uses a new package name: @apollo/client

ApolloClient

  • [BREAKING] ApolloClient is now only available as a named export. The default ApolloClient export has been removed.
    @hwillson in #5425

  • [BREAKING] The queryManager property of ApolloClient instances is now marked as private, paving the way for a more aggressive redesign of its API.

  • [BREAKING] Apollo Client will no longer deliver "stale" results to ObservableQuery consumers, but will instead log more helpful errors about which cache fields were missing.
    @benjamn in #6058

  • [BREAKING] ApolloError's thrown by Apollo Client no longer prefix error messages with GraphQL error: or Network error:. To differentiate between GraphQL/network errors, refer to ApolloError's public graphQLErrors and networkError properties.
    @lorensr in #3892

  • [BREAKING] Support for the @live directive has been removed, but might be restored in the future if a more thorough implementation is proposed.
    @benjamn in #6221

  • [BREAKING] Apollo Client 2.x allowed @client fields to be passed into the link chain if resolvers were not set in the constructor. This allowed @client fields to be passed into Links like apollo-link-state. Apollo Client 3 enforces that @client fields are local only, meaning they are no longer passed into the link chain, under any circumstances.
    @hwillson in #5982

  • [BREAKING?] Refactor QueryManager to make better use of observables and enforce fetchPolicy more reliably.
    @benjamn in #6221

  • The updateQuery function previously required by fetchMore has been deprecated with a warning, and will be removed in the next major version of Apollo Client. Please consider using a merge function to handle incoming data instead of relying on updateQuery.
    @benjamn in #6464

  • Helper functions for generating common pagination-related field policies may be imported from @apollo/client/utilities. The most basic helper is concatPagination, which emulates the concatenation behavior of typical updateQuery functions. A more sophisticated helper is offsetLimitPagination, which implements offset/limit-based pagination. If you are consuming paginated data from a Relay-friendly API, use relayStylePagination. Feel free to use these helper functions as inspiration for your own field policies, and/or modify them to suit your needs.
    @benjamn in #6465

  • Updated to work with graphql@15.
    @durchanek in #6194 and #6279
    @hagmic in #6328

  • Apollo Link core and HTTP related functionality has been merged into @apollo/client. Functionality that was previously available through the apollo-link, apollo-link-http-common and apollo-link-http packages is now directly available from @apollo/client (e.g. import { HttpLink } from '@apollo/client'). The ApolloClient constructor has also been updated to accept new uri, headers and credentials options. If uri is specified, Apollo Client will take care of creating the necessary HttpLink behind the scenes.
    @hwillson in #5412

  • The gql template tag should now be imported from the @apollo/client package, rather than the graphql-tag package. Although the graphql-tag package still works for now, future versions of @apollo/client may change the implementation details of gql without a major version bump.
    @hwillson in #5451

  • @apollo/client/core can be used to import the Apollo Client core, which includes everything the main @apollo/client package does, except for all React related functionality.
    @kamilkisiela in #5541

  • Several deprecated methods have been fully removed:

    • ApolloClient#initQueryManager
    • QueryManager#startQuery
    • ObservableQuery#currentResult
  • Apollo Client now supports setting a new ApolloLink (or link chain) after new ApolloClient() has been called, using the ApolloClient#setLink method.
    @hwillson in #6193

  • The final time a mutation update function is called, it can no longer accidentally read optimistic data from other concurrent mutations, which ensures the use of optimistic updates has no lasting impact on the state of the cache after mutations have finished.
    @benjamn in #6551

  • Apollo links that were previously maintained in https://github.com/apollographql/apollo-link have been merged into the Apollo Client project. They should be accessed using the new entry points listed in the migration guide.
    @hwillson in #

InMemoryCache

⚠️ Note: InMemoryCache has been significantly redesigned and rewritten in Apollo Client 3.0. Please consult the migration guide and read the new documentation to understand everything that has been improved.

  • The InMemoryCache constructor should now be imported directly from @apollo/client, rather than from a separate package. The apollo-cache-inmemory package is no longer supported.

    The @apollo/client/cache entry point can be used to import InMemoryCache without importing other parts of the Apollo Client codebase.
    @hwillson in #5577

  • [BREAKING] FragmentMatcher, HeuristicFragmentMatcher, and IntrospectionFragmentMatcher have all been removed. We now recommend using InMemoryCache’s possibleTypes option instead. For more information see the Defining possibleTypes manually section of the docs.
    @benjamn in #5073

  • [BREAKING] As promised in the Apollo Client 2.6 blog post, all cache results are now frozen/immutable.
    @benjamn in #5153

  • [BREAKING] Eliminate "generated" cache IDs to avoid normalizing objects with no meaningful ID, significantly reducing cache memory usage. This might be a backwards-incompatible change if your code depends on the precise internal representation of normalized data in the cache.
    @benjamn in #5146

  • [BREAKING] InMemoryCache will no longer merge the fields of written objects unless the objects are known to have the same identity, and the values of fields with the same name will not be recursively merged unless a custom merge function is defined by a field policy for that field, within a type policy associated with the __typename of the parent object.
    @benjamn in #5603

  • [BREAKING] InMemoryCache now throws when data with missing or undefined query fields is written into the cache, rather than just warning in development.
    @benjamn in #6055

  • [BREAKING] client|cache.writeData have been fully removed. writeData usage is one of the easiest ways to turn faulty assumptions about how the cache represents data internally, into cache inconsistency and corruption. client|cache.writeQuery, client|cache.writeFragment, and/or cache.modify can be used to update the cache.
    @benjamn in #5923

  • InMemoryCache now supports tracing garbage collection and eviction. Note that the signature of the evict method has been simplified in a potentially backwards-incompatible way.
    @benjamn in #5310

  • [beta-BREAKING] Please note that the cache.evict method now requires Cache.EvictOptions, though it pr...

Read more

v3.0.0-rc.0

02 Jun 16:11
25c24b8
Compare
Choose a tag to compare
v3.0.0-rc.0 Pre-release
Pre-release

Now that the release candidate phase of testing has begun, we will do our very best to avoid introducing any new features or breaking API changes, unless those changes are absolutely necessary to fix bugs.

We are very much aware of a number of outstanding bugs, and we fully intend to fix all known bugs before the final AC3 release, in addition to continuing to write and edit the documentation for new AC3 features: https://github.com/apollographql/apollo-client/milestone/14

If you have been waiting for a signal that the AC3 API is stable/frozen, this is it. However, if you are not interested in helping to identify and fix (or at least work around) the remaining issues, then you should wait for the final release before updating.

Changes: https://github.com/apollographql/apollo-client/blob/v3.0.0-rc.0/CHANGELOG.md

2.6.8

14 Dec 12:06
Compare
Choose a tag to compare

Apollo Client 2.6.8

Apollo Client (2.6.8)

GraphQL Anywhere (4.2.6)

Apollo Boost (0.4.7)

  • Replace GlobalFetch reference with WindowOrWorkerGlobalScope.
    @abdonrd in #5373

  • Add assumeImmutableResults typing to apollo boost PresetConfig interface.
    @bencoullie in #5571