Skip to content

Latest commit

 

History

History
2124 lines (1435 loc) · 129 KB

CHANGELOG.md

File metadata and controls

2124 lines (1435 loc) · 129 KB

Apollo Client 3.4.13

Bug Fixes

  • Fix componentDidUpate typo in withSubscription higher-order component.
    @YarBez in #7506

  • Fix internal canUseSymbol import within @apollo/client/utilities to avoid breaking bundlers/builds.
    @benjamn in #8817

  • Tolerate unfreezable objects like Uint8Array and Buffer in maybeDeepFreeze.
    @geekuillaume and @benjamn in #8813

Apollo Client 3.4.12

Bug Fixes

  • Improve handling of falsy existing and/or incoming parameters in relayStylePagination field policy helper function.
    @bubba and @benjamn in #8733

  • Associate Apollo context with React.createContext (instead of using a local WeakMap) again, so multiple copies of @apollo/client (uncommon) can share the same context.
    @benjamn in #8798

Apollo Client 3.4.11

Bug Fixes

  • Fix Vite tree-shaking by calling the checkDEV() function (at least once) in the module that exports it, @apollo/client/utilities/globals/index.ts.
    @benjamn in #8767

Improvements

  • Export PersistedQueryLink namespace from @apollo/client/link/persisted-queries.
    @vedrani in #8761

Documentation

Apollo Client 3.4.10

Improvements

  • Warn when calling refetch({ variables }) instead of refetch(variables), except for queries that declare a variable named $variables (uncommon).
    @benjamn in #8702

Bug Fixes

  • Fix ObservableQuery.getCurrentResult() returning cached data with certain fetch policies.
    @brainkim in #8718

  • Prevent ssrMode/ssrForceFetchDelay from causing queries to hang.
    @brainkim in #8709

  • Import @apollo/client/utilities/globals internally wherever __DEV__ is used, not just in @apollo/client/**/index.js entry points.
    @benjamn in #8720

Apollo Client 3.4.9

Bug Fixes

  • Fix unhandled Promise rejection warnings/errors whose message is Observable cancelled prematurely.
    @benjamn in #8676

  • Enforce that __DEV__ is polyfilled by every @apollo/client/* entry point that uses it. This build step considers not only explicit __DEV__ usage but also __DEV__ references injected near invariant(...) and new InvariantError(...) expressions.
    @benjamn in #8689

Apollo Client 3.4.8

Bug Fixes

  • Fix error thrown by nested keyFields: ["a", ["b", "c"], "d"] type policies when writing results into the cache where any of the key fields (.a, .a.b, .a.c, or .d) have been renamed by query field alias syntax.
    @benjamn in #8643

  • Fix regression from PR #8422 (first released in @apollo/client@3.4.0-rc.15) that caused result.data to be set to undefined in some cases after ObservableQuery#getCurrentResult reads an incomplete result from the cache.
    @benjamn in #8642

Apollo Client 3.4.7

Bug Fixes

  • Fix accidental reuse of recycled MergeTree objects in StoreWriter class used by InMemoryCache.
    @benjamn in #8618

Apollo Client 3.4.6

Improvements

  • Reevaluate window.fetch each time HttpLink uses it, if not configured using options.fetch. This change enables a variety of strategies for instrumenting window.fetch, without requiring those strategies to run before @apollo/client/link/http is first imported.
    @benjamn in #8603

  • Clarify mutation fetchPolicy options ("network-only" or "no-cache") using MutationFetchPolicy union type.
    @benjamn in #8602

Bug Fixes

  • Restore full @apollo/client/apollo-client.cjs.js CommonJS bundle for older bundlers.

    Note that Node.js and CommonJS bundlers typically use the bundles specified by "main" fields in our generated package.json files, which are all independent and non-overlapping CommonJS modules. However, apollo-client.cjs.js is just one big bundle, so mixing imports of apollo-client.cjs.js with the other CommonJS bundles is discouraged, as it could trigger the dual package hazard. In other words, please don't start using apollo-client.cjs.js if you're not already.

    @benjamn in #8592

  • Log MissingFieldErrors in ObservableQuery#getCurrentResult using invariant.debug, rather than reporting them via result.error.
    @benjamn in #8604

Apollo Client 3.4.5

Bug Fixes

  • Fix double registration bug for mutation refetchQueries specified using legacy one-time refetchQueries: [{ query, variables }] style. Though the bug is fixed, we recommend using refetchQueries: [query] instead (when possible) to refetch an existing query using its DocumentNode, rather than creating, executing, and then deleting a new query, as the legacy { query, variables } style unfortunately does.
    @benjamn in #8586

  • Fix useQuery/useLazyQuery stalling when clients or queries change.
    @brainkim in #8589

Apollo Client 3.4.4

Bug Fixes

  • Revert accidental addition of engines.npm section to published version of @apollo/client/package.json.
    @benjamn in #8578

Apollo Client 3.4.3

Bug Fixes

  • Fix { ssr: false } causing queries to hang on the client.
    @brainkim in #8574

Apollo Client 3.4.2

Bug Fixes

  • Use more default type parameters for mutation-related types in react/types/types.ts, to provide smoother backwards compatibility for code using those types explicitly.
    @benjamn in #8573

Apollo Client 3.4.1

Bug Fixes

  • Initialize stringifyCanon lazily, when canonicalStringify is first called, fixing Uncaught ReferenceError: __DEV__ is not defined errors due to usage of __DEV__ before declaration.
    @benjamn in #8557

Apollo Client 3.4.0

New documentation

Improvements

  • InMemoryCache now guarantees that any two result objects returned by the cache (from readQuery, readFragment, etc.) will be referentially equal (===) if they are deeply equal. Previously, === equality was often achievable for results for the same query, on a best-effort basis. Now, equivalent result objects will be automatically shared among the result trees of completely different queries. This guarantee is important for taking full advantage of optimistic updates that correctly guess the final data, and for "pure" UI components that can skip re-rendering when their input data are unchanged.
    @benjamn in #7439

  • Mutations now accept an optional callback function called onQueryUpdated, which will be passed the ObservableQuery and Cache.DiffResult objects for any queries invalidated by cache writes performed by the mutation's final update function. Using onQueryUpdated, you can override the default FetchPolicy of the query, by (for example) calling ObservableQuery methods like refetch to force a network request. This automatic detection of invalidated queries provides an alternative to manually enumerating queries using the refetchQueries mutation option. Also, if you return a Promise from onQueryUpdated, the mutation will automatically await that Promise, rendering the awaitRefetchQueries option unnecessary.
    @benjamn in #7827

  • Support client.refetchQueries as an imperative way to refetch queries, without having to pass options.refetchQueries to client.mutate.
    @dannycochran in #7431

  • Improve standalone client.refetchQueries method to support automatic detection of queries needing to be refetched.
    @benjamn in #8000

  • Fix remaining barriers to loading @apollo/client/core as native ECMAScript modules from a CDN like esm.run. Importing @apollo/client from a CDN will become possible once we move all React-related dependencies into @apollo/client/react in Apollo Client 4.
    @benjamn in #8266

  • InMemoryCache supports a new method called batch, which is similar to performTransaction but takes named options rather than positional parameters. One of these named options is an onDirty(watch, diff) callback, which can be used to determine which watched queries were invalidated by the batch operation.
    @benjamn in #7819

  • Allow merge: true field policy to merge Reference objects with non-normalized objects, and vice-versa.
    @benjamn in #7778

  • Allow identical subscriptions to be deduplicated by default, like queries.
    @jkossis in #6910

  • Always use POST request when falling back to sending full query with @apollo/client/link/persisted-queries.
    @rieset in #7456

  • The FetchMoreQueryOptions type now takes two instead of three type parameters (<TVariables, TData>), thanks to using Partial<TVariables> instead of K extends typeof TVariables and Pick<TVariables, K>.
    @ArnaudBarre in #7476

  • Pass variables and context to a mutation's update function. Note: The type of the update function is now named MutationUpdaterFunction rather than MutationUpdaterFn, since the older type was broken beyond repair. If you are using MutationUpdaterFn in your own code, please use MutationUpdaterFunction instead.
    @jcreighton in #7902

  • A resultCacheMaxSize option may be passed to the InMemoryCache constructor to limit the number of result objects that will be retained in memory (to speed up repeated reads), and calling cache.reset() now releases all such memory.
    @SofianHn in #8701

  • Fully remove result cache entries from LRU dependency system when the corresponding entities are removed from InMemoryCache by eviction, or by any other means.
    @sofianhn and @benjamn in #8147

  • Expose missing field errors in results.
    @brainkim in #8262

  • Add expected/received variables to No more mocked responses... error messages generated by MockLink.
    @markneub in #8340

  • The InMemoryCache version of the cache.gc method now supports additional options for removing non-essential (recomputable) result caching data.
    @benjamn in #8421

  • Suppress noisy Missing cache result fields... warnings by default unless setLogVerbosity("debug") called.
    @benjamn in #8489

  • Improve interaction between React hooks and React Fast Refresh in development.
    @andreialecu in #7952

Potentially disruptive changes

  • To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4 automatically clears any ROOT_MUTATION fields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing the keepRootFields: true option to client.mutate. ROOT_MUTATION result data are also passed to the mutation update function, so we recommend obtaining the results that way, rather than using keepRootFields: true, if possible.
    @benjamn in #8280

  • Internally, Apollo Client now controls the execution of development-only code using the __DEV__ global variable, rather than process.env.NODE_ENV. While this change should not cause any visible differences in behavior, it will increase your minified+gzip bundle size by more than 3.5kB, unless you configure your minifier to replace __DEV__ with a true or false constant, the same way you already replace process.env.NODE_ENV with a string literal like "development" or "production". For an example of configuring a Create React App project without ejecting, see this pull request for our React Apollo reproduction template.
    @benjamn in #8347

  • Internally, Apollo Client now uses namespace syntax (e.g. import * as React from "react") for imports whose types are re-exported (and thus may appear in .d.ts files). This change should remove any need to configure esModuleInterop or allowSyntheticDefaultImports in tsconfig.json, but might require updating bundler configurations that specify named exports of the react and prop-types packages, to include exports like createContext and createElement (example).
    @devrelm in #7742

  • Respect no-cache fetch policy (by not reading any data from the cache) for loading: true results triggered by notifyOnNetworkStatusChange: true.
    @jcreighton in #7761

  • The TypeScript return types of the getLastResult and getLastError methods of ObservableQuery now correctly include the possibility of returning undefined. If you happen to be calling either of these methods directly, you may need to adjust how the calling code handles the methods' possibly-undefined results.
    @benjamn in #8394

  • Log non-fatal invariant.error message when fields are missing from result objects written into InMemoryCache, rather than throwing an exception. While this change relaxes an exception to be merely an error message, which is usually a backwards-compatible change, the error messages are logged in more cases now than the exception was previously thrown, and those new error messages may be worth investigating to discover potential problems in your application. The errors are not displayed for @client-only fields, so adding @client is one way to handle/hide the errors for local-only fields. Another general strategy is to use a more precise query to write specific subsets of data into the cache, rather than reusing a larger query that contains fields not present in the written data.
    @benjamn in #8416

  • The nextFetchPolicy option for client.watchQuery and useQuery will no longer be removed from the options object after it has been applied, and instead will continue to be applied any time options.fetchPolicy is reset to another value, until/unless the options.nextFetchPolicy property is removed from options.
    @benjamn in #8465

  • The fetchMore, subscribeToMore, and updateQuery functions returned from the useQuery hook may now return undefined in edge cases where the functions are called when the component is unmounted
    @noghartt in #7980.

Bug fixes

  • In Apollo Client 2.x, a refetch operation would always replace existing data in the cache. With the introduction of field policy merge functions in Apollo Client 3, existing field values could be inappropriately combined with incoming field values by a custom merge function that does not realize a refetch has happened.

    To give you more control over this behavior, we have introduced an overwrite?: boolean = false option for cache.writeQuery and cache.writeFragment, and an option called refetchWritePolicy?: "merge" | "overwrite" for client.watchQuery, useQuery, and other functions that accept WatchQueryOptions. You can use these options to make sure any merge functions involved in cache writes for refetch operations get invoked with undefined as their first argument, which simulates the absence of any existing data, while still giving the merge function a chance to determine the internal representation of the incoming data.

    The default behaviors are overwrite: true and refetchWritePolicy: "overwrite", which restores the Apollo Client 2.x behavior, but (if this change causes any problems for your application) you can easily recover the previous merging behavior by setting a default value for refetchWritePolicy in defaultOptions.watchQuery:

    new ApolloClient({
      defaultOptions: {
        watchQuery: {
          refetchWritePolicy: "merge",
        },
      },
    })

    @benjamn in #7810

  • Make sure the MockedResponse ResultFunction type is re-exported.
    @hwillson in #8315

  • Fix polling when used with skip.
    @brainkim in #8346

  • InMemoryCache now coalesces EntityStore updates to guarantee only one store.merge(id, fields) call per id per cache write.
    @benjamn in #8372

  • Fix polling when used with <React.StrictMode>.
    @brainkim in #8414

  • Fix the React integration logging Warning: Can't perform a React state update on an unmounted component.
    @wuarmin in #7745

  • Make ObservableQuery#getCurrentResult always call queryInfo.getDiff().
    @benjamn in #8422

  • Make readField default to reading from current object only when the from option/argument is actually omitted, not when from is passed to readField with an undefined value. A warning will be printed when this situation occurs.
    @benjamn in #8508

  • The fetchMore, subscribeToMore, and updateQuery functions no longer throw undefined errors
    @noghartt in #7980.

Apollo Client 3.3.21

Bug fixes

  • Fix race condition in @apollo/client/link/context that could leak subscriptions if the subscription is cancelled before operation.setContext is called.
    @sofianhn in #8399

  • Prefer existing.pageInfo.startCursor and endCursor (if defined) in read function of relayStylePagination policies.
    @benjamn in #8438

Improvements

  • Normalize user-provided HttpLink headers by lower-casing their names.
    @benjamn in #8449

Apollo Client 3.3.20

Bug fixes

  • Fix policy merging bug when calling cache.policies.addTypePolicies multiple times for the same type policy.
    @Banou26 in #8361

Apollo Client 3.3.19

Bug fixes

  • Use export ... from syntax to re-export graphql-tag named exports, making tree-shaking easier for some bundlers.
    @benjamn in #8221

Documentation

Apollo Client 3.3.18

Bug fixes

  • Add "sideEffects": false to all generated/published package.json files, to improve dead code elimination for nested entry points like @apollo/client/cache.
    @benjamn in #8213

Apollo Client 3.3.17

Bug fixes

  • Make useReactiveVar(rv) recheck the latest rv() value in its useEffect callback, and immediately update state if the value has already changed, rather than calling rv.onNextChange(setValue) to listen for future changes.
    @benjamn in #8135

Apollo Client 3.3.16

Bug fixes

  • Prevent undefined mutation result in useMutation.
    @jcreighton in #8018

  • Fix useReactiveVar not rerendering for successive synchronous calls.
    @brainkim in #8022

  • Support batchDebounce option for BatchLink and BatchHttpLink.
    @dannycochran in #8024

Apollo Client 3.3.15

  • Increment queryInfo.lastRequestId only when making a network request through the ApolloLink chain, rather than every time fetchQueryByPolicy is called.
    @dannycochran in #7956

  • During server-side rendering, allow initial useQuery calls to return final { loading: false, data } results when the cache already contains the necessary data.
    @benjamn in #7983

Apollo Client 3.3.14

Improvements

  • Adjust TypeScript types to allow keyFields and keyArgs functions to return false.
    @CarsonF and @benjamn in #7900

Bug fixes

  • Prevent RenderPromises memory leak by calling renderPromises.clear() after getMarkupFromTree finishes.
    @benjamn in #7943

  • Cancel pending notify timeout when stopping a QueryInfo object.
    @hollandThomas in #7935

  • Fix infinite rendering bug related to useSubscription.
    @brainkim in #7917

Apollo Client 3.3.13

Improvements

  • Add missing context option to useSubscription.
    @jcreighton in #7860

  • Remove unnecessary TypeScript global Observable<T>["@@observable"] method declaration.
    @benjamn in #7888

  • Prevent skipped/observerless ObservableQuerys from being refetched by refetchQueries.
    @dannycochran in #7877

Apollo Client 3.3.12

Bug fixes

  • Maintain serial ordering of asyncMap mapping function calls, and prevent potential unhandled Promise rejection errors.
    @benjamn in #7818

  • Relax incompatible children?: React.ReactElement field type in MockedProviderProps interface.
    @kevinperaza in #7833

Apollo Client 3.3.11

Bug fixes

  • Fix useLazyQuery forceUpdate loop regression introduced by #7655 in version 3.3.10.
    @benjamn in #7715

Apollo Client 3.3.10

Bug fixes

  • Revert PR #7276, but test that garbage collection reclaims torn-down ObservableQuery objects.
    @benjamn in #7695

  • Reset QueryInfo.diff and QueryInfo.dirty after canceling notify timeout in QueryInfo.markResult and QueryInfo.markError.
    @jcreighton in #7696

Improvements

  • Avoid calling forceUpdate when component is unmounted.
    @DylanVann in #7655

  • The codemods/ top-level directory has been moved into the scripts/ directory.
    @benjamn in #7675

Apollo Client 3.3.9

Bug Fixes

  • Prevent reactive variables from retaining otherwise unreachable InMemoryCache objects.
    @benjamn in #7661

Improvements

  • The graphql-tag dependency has been updated to version 2.12.0, after converting its repository to use TypeScript and ECMAScript module syntax. There should be no visible changes in behavior, though the internal changes seemed significant enough to mention here.
    @abdonrd in graphql-tag#273 and @PowerKiKi in graphql-tag#325

Apollo Client 3.3.8

Bug Fixes

  • Catch updates in useReactiveVar with an additional check.
    @jcreighton in #7652

  • Reactivate forgotten reactive variables whenever InMemoryCache acquires its first watcher.
    @benjamn in #7657

  • Backport Symbol.species fix for Concast and ObservableQuery from release-3.4, fixing subscriptions in React Native Android when the Hermes JavaScript engine is enabled (among other benefits).
    @benjamn in #7403 and #7660

Apollo Client 3.3.7

Bug Fixes

  • Fix a regression due to #7310 that caused loading always to be true for skip: true results during server-side rendering.
    @rgrove in #7567

  • Avoid duplicate useReactiveVar listeners when rendering in React.StrictMode.
    @jcreighton in #7581

Improvements

  • Set displayName on ApolloContext objects for easier debugging.
    @dulmandakh in #7550

Apollo Client 3.3.6

Bug Fixes

  • Immediately apply queryType: true, mutationType: true, and subscriptionType: true type policies, rather than waiting for the first time the policy is used, fixing a regression introduced by #7065.
    @benjamn in #7463

  • Check that window is defined even when connectToDevTools is true.
    @yasupeke in #7434

Improvements

  • Replace stray console.debug (undefined in React Native) with invariant.log.
    @benjamn in #7454

  • Suggest Firefox Apollo DevTools as well as the Chrome extension.
    @benjamn in #7461

Apollo Client 3.3.5

Improvements

  • Restore client.version property, reflecting the current @apollo/client version from package.json.
    @benjamn in #7448

Apollo Client 3.3.4

Improvements

Apollo Client 3.3.3

Bug fixes

  • Make the observer parameter of ApolloLink#onError optional, fixing an unnecessary breaking change for any code that called onError directly.
    @benjamn in #7407

Apollo Client 3.3.2

⚠️ Note: This version of @apollo/client contains no behavioral changes since version 3.3.1

Documentation

Apollo Client 3.3.1

Bug Fixes

  • Revert back to default-importing React internally, rather than using a namespace import.
    @benjamn in 113475b1

Apollo Client 3.3.0

Bug Fixes

  • Update @wry/equality to consider undefined properties equivalent to missing properties.
    @benjamn in #7108

  • Prevent memory leaks involving unused onBroadcast function closure created in ApolloClient constructor.
    @kamilkisiela in #7161

  • Provide default empty cache object for root IDs like ROOT_QUERY, to avoid differences in behavior before/after ROOT_QUERY data has been written into InMemoryCache.
    @benjamn in #7100

  • Cancel queryInfo.notifyTimeout in QueryInfo#markResult to prevent unnecessary network requests when using a FetchPolicy of cache-and-network or network-only in a React component with multiple useQuery calls.
    @benjamn in #7347

Potentially breaking changes

  • Ensure cache.readQuery and cache.readFragment always return TData | null, instead of throwing MissingFieldError exceptions when missing fields are encountered.
    @benjamn in #7098

    Since this change converts prior exceptions to null returns, and since null was already a possible return value according to the TData | null return type, we are confident this change will be backwards compatible (as long as null was properly handled before).

  • HttpLink will now automatically strip any unused variables before sending queries to the GraphQL server, since those queries are very likely to fail validation, according to the All Variables Used rule in the GraphQL specification. If you depend on the preservation of unused variables, you can restore the previous behavior by passing includeUnusedVariables: true to the HttpLink constructor (which is typically passed as options.link to the ApolloClient constructor).
    @benjamn in #7127

  • Ensure MockLink (used by MockedProvider) returns mock configuration errors (e.g. No more mocked responses for the query ...) through the Link's Observable, instead of throwing them. These errors are now available through the error property of a result.
    @hwillson in #7110

    Returning mock configuration errors through the Link's Observable was the default behavior in Apollo Client 2.x. We changed it for 3, but the change has been problematic for those looking to migrate from 2.x to 3. We've decided to change this back with the understanding that not many people want or are relying on MockLink's throwing exception approach. If you want to change this functionality, you can define custom error handling through MockLink.setOnError.

  • Unsubscribing the last observer from an ObservableQuery will once again unsubscribe from the underlying network Observable in all cases, as in Apollo Client 2.x, allowing network requests to be cancelled by unsubscribing.
    @javier-garcia-meteologica in #7165 and #7170.

  • The independent QueryBaseOptions and ModifiableWatchQueryOptions interface supertypes have been eliminated, and their fields are now defined by QueryOptions.
    @DCtheTall in #7136

  • Internally, Apollo Client now avoids nested imports from the graphql package, importing everything from the top-level package instead. For example,

    import { visit } from "graphql/language/visitor"

    is now just

    import { visit } from "graphql"

    Since the graphql package uses .mjs modules, your bundler may need to be configured to recognize .mjs files as ECMAScript modules rather than CommonJS modules.
    @benjamn in #7185

Improvements

  • Support inheritance of type and field policies, according to possibleTypes.
    @benjamn in #7065

  • Allow configuring custom merge functions, including the merge: true and merge: false shorthands, in type policies as well as field policies.
    @benjamn in #7070

  • The verbosity of Apollo Client console messages can be globally adjusted using the setLogVerbosity function:

    import { setLogVerbosity } from "@apollo/client";
    setLogVerbosity("log"); // display all messages
    setLogVerbosity("warn"); // display only warnings and errors (default)
    setLogVerbosity("error"); // display only errors
    setLogVerbosity("silent"); // hide all console messages

    Remember that all logs, warnings, and errors are hidden in production.
    @benjamn in #7226

  • Modifying InMemoryCache fields that have keyArgs configured will now invalidate only the field value with matching key arguments, rather than invalidating all field values that share the same field name. If keyArgs has not been configured, the cache must err on the side of invalidating by field name, as before.
    @benjamn in #7351

  • Shallow-merge options.variables when combining existing or default options with newly-provided options, so new variables do not completely overwrite existing variables.
    @amannn in #6927

  • Avoid displaying Cache data may be lost... warnings for scalar field values that happen to be objects, such as JSON data.
    @benjamn in #7075

  • In addition to the result.data property, useQuery and useLazyQuery will now provide a result.previousData property, which can be useful when a network request is pending and result.data is undefined, since result.previousData can be rendered instead of rendering an empty/loading state.
    @hwillson in #7082

  • Passing validate: true to the SchemaLink constructor will enable validation of incoming queries against the local schema before execution, returning validation errors in result.errors, just like a non-local GraphQL endpoint typically would.
    @amannn in #7094

  • Allow optional arguments in keyArgs: [...] arrays for InMemoryCache field policies.
    @benjamn in #7109

  • Avoid registering QueryPromise when skip is true during server-side rendering.
    @izumin5210 in #7310

  • ApolloCache objects (including InMemoryCache) may now be associated with or disassociated from individual reactive variables by calling reactiveVar.attachCache(cache) and/or reactiveVar.forgetCache(cache).
    @benjamn in #7350

Apollo Client 3.2.9

Bug Fixes

  • Revert back to default-importing React internally, rather than using a namespace import.
    @benjamn in 113475b1

Apollo Client 3.2.8

Bug Fixes

  • Ensure sourcesContent array is properly defined in .js.map files generated by tsc.
    @benjamn in #7371

  • Avoid relying on global Symbol properties in ApolloContext.ts.
    @benjamn in #7371

Apollo Client 3.2.7

Bug Fixes

  • Revert updating symbol-observable from version 2.x to version 3, which caused TypeScript errors with some @types/node versions, especially in Angular applications.
    @benjamn in #7340

Apollo Client 3.2.6

Bug Fixes

  • Always consider singleton IDs like ROOT_QUERY and ROOT_MUTATION to be root IDs during cache.gc garbage collection, regardless of whether they have been retained or released.
    @benjamn in #7333

  • Use optional chaining syntax (this.currentObservable?.refetch) in React refetch wrapper function to avoid crashing when an unmounted component is accidentally refetched.
    @tm1000 in #6314 and @linmic in #7186

Improvements

  • Handle older react-apollo package in codemods/ac2-to-ac3/imports.js migration script.
    @tm1000 in #7216

  • Ensure relayStylePagination preserves pageInfo.{start,end}Cursor if edges is missing or empty.
    @beaucollins in #7224

Apollo Client 3.2.5

Improvements

  • Move terser dependency from dependencies to devDependencies.
    @SimenB in #7188

  • Avoid all sub-package imports from the graphql npm package.
    @stoically in #7185

Apollo Client 3.2.4

Improvements

  • Update the optimism npm dependency to version 0.13.0 in order to use the new optimistic.forget method to fix a potential cache.watch memory leak.
    @benjamn in #7157

  • Consider cache.reset a destructive method, like cache.evict and cache.modify.
    @joshjg in #7150

  • Avoid refetching observerless queries with reFetchObservableQueries.
    @joshjg in #7146

Apollo Client 3.2.3

Improvements

  • Default args.offset to zero in offsetLimitPagination.
    @benjamn in #7141

Apollo Client 3.2.2

Bug Fixes

  • Undo TEdgeWrapper approach for relayStylePagination, introduced by f41e9efc in #7023, since it was an unintended breaking change for existing code that used cache.modify to interact with field data managed by relayStylePagination.
    @benjamn in #7103

Apollo Client 3.2.1

Bug Fixes

  • Fix relayStylePagination to handle the possibility that edges might be normalized Reference objects (uncommon).
    @anark and @benjamn in #7023

  • Disable "Missing cache result fields" warnings when returnPartialData is true.
    @hwillson in #7055

Improvements

  • Mark subscriptions-transport-ws peerDependency as optional.
    @MasterOdin in #7047

Apollo Client 3.2.0

Bug Fixes

  • Use options.nextFetchPolicy internally to restore original FetchPolicy after polling with fetchPolicy: "network-only", so that polling does not interfere with normal query watching.
    @benjamn in #6893

  • Initialize ObservableQuery in updateObservableQuery even if skip is true.
    @mu29 in #6999

  • Prevent full reobservation of queries affected by optimistic mutation updates, while still delivering results from the cache.
    @benjamn in #6854

Improvements

  • In TypeScript, all APIs that take DocumentNode parameters now may alternatively take TypeDocumentNode<Data, Variables>. This type has the same JavaScript representation but allows the APIs to infer the data and variable types instead of requiring you to specify types explicitly at the call site.
    @dotansimha in #6720

  • Bring back an improved form of heuristic fragment matching, by allowing possibleTypes to specify subtype regular expression strings, which count as matches if the written result object has all the fields expected for the fragment.
    @benjamn in #6901

  • Allow options.nextFetchPolicy to be a function that takes the current FetchPolicy and returns a new (or the same) FetchPolicy, making nextFetchPolicy more suitable for global use in defaultOptions.watchQuery.
    @benjamn in #6893

  • Implement useReactiveVar hook for consuming reactive variables in React components.
    @benjamn in #6867

  • Move apollo-link-persisted-queries implementation to @apollo/client/link/persisted-queries. Try running our automated imports transform to handle this conversion, if you're using apollo-link-persisted-queries.
    @hwillson in #6837

  • Disable feud-stopping logic after any cache.evict or cache.modify operation.
    @benjamn in #6817 and #6898

  • Throw if writeFragment cannot identify options.data when no options.id provided.
    @jcreighton in #6859

  • Provide options.storage object to cache.modify functions, as provided to read and merge functions.
    @benjamn in #6991

  • Allow cache.modify functions to return details.INVALIDATE (similar to details.DELETE) to invalidate the current field, causing affected queries to rerun, even if the field's value is unchanged.
    @benjamn in #6991

  • Support non-default ErrorPolicy values (that is, "ignore" and "all", in addition to the default value "none") for mutations and subscriptions, like we do for queries.
    @benjamn in #7003

  • Remove invariant forbidding a FetchPolicy of cache-only in ObservableQuery#refetch.
    @benjamn in ccb0a79a, fixing #6702

Apollo Client 3.1.5

Bug Fixes

  • Make ApolloQueryResult.data field non-optional again.
    @benjamn in #6997

Improvements

  • Allow querying Connection metadata without args in relayStylePagination.
    @anark in #6935

Apollo Client 3.1.4

Bug Fixes

  • Restrict root object identification to ROOT_QUERY (the ID corresponding to the root Query object), allowing Mutation and Subscription as user-defined types.
    @benjamn in #6914

  • Prevent crash when pageInfo and empty edges are received by relayStylePagination.
    @fracmak in #6918

Apollo Client 3.1.3

Bug Fixes

  • Consider only result.data (rather than all properties of result) when settling cache feuds.
    @danReynolds in #6777

Improvements

Apollo Client 3.1.2

Bug Fixes

Improvements

  • Allow SchemaLink.Options.context function to be async (or return a Promise).
    @benjamn in #6735

Apollo Client 3.1.1

Bug Fixes

  • Re-export cache types from @apollo/client/core (and thus also @apollo/client), again.
    @benjamn in #6725

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

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 previously supported positional arguments as well.
      @danReynolds in #6141 @benjamn in #6364

    • Removing an entity object using the cache.evict method does not automatically remove dangling references to that entity elsewhere in the cache, but dangling references will be automatically filtered from lists whenever those lists are read from the cache. You can define a custom field read function to customize this behavior. See #6412, #6425, and #6454 for further explanation.

  • Cache methods that would normally trigger a broadcast, like cache.evict, cache.writeQuery, and cache.writeFragment, can now be called with a named options object, which supports a broadcast: boolean property that can be used to silence the broadcast, for situations where you want to update the cache multiple times without triggering a broadcast each time.
    @benjamn in #6288

  • InMemoryCache now console.warns in development whenever non-normalized data is dangerously overwritten, with helpful links to documentation about normalization and custom merge functions.
    @benjamn in #6372

  • The result caching system (introduced in #3394) now tracks dependencies at the field level, rather than at the level of whole entity objects, allowing the cache to return identical (===) results much more often than before.
    @benjamn in #5617

  • InMemoryCache now has a method called modify which can be used to update the value of a specific field within a specific entity object:

    cache.modify({
      id: cache.identify(post),
      fields: {
        comments(comments: Reference[], { readField }) {
          return comments.filter(comment => idToRemove !== readField("id", comment));
        },
      },
    });

    This API gracefully handles cases where multiple field values are associated with a single field name, and also removes the need for updating the cache by reading a query or fragment, modifying the result, and writing the modified result back into the cache. Behind the scenes, the cache.evict method is now implemented in terms of cache.modify.
    @benjamn in #5909 and #6178

  • InMemoryCache provides a new API for storing client state that can be updated from anywhere:

    import { makeVar } from "@apollo/client"
    const v = makeVar(123)
    console.log(v()) // 123
    console.log(v(v() + 1)) // 124
    console.log(v()) // 124
    v("asdf") // TS type error

    These variables are reactive in the sense that updating their values invalidates any previously cached query results that depended on the old values.
    @benjamn in #5799, #5976, and #6512

  • Various cache read and write performance optimizations, cutting read and write times by more than 50% in larger benchmarks.
    @benjamn in #5948

  • The cache.readQuery and cache.writeQuery methods now accept an options.id string, which eliminates most use cases for cache.readFragment and cache.writeFragment, and skips the implicit conversion of fragment documents to query documents performed by cache.{read,write}Fragment.
    @benjamn in #5930

  • Support cache.identify(entity) for easily computing entity ID strings.
    @benjamn in #5642

  • Support eviction of specific entity fields using cache.evict(id, fieldName).
    @benjamn in #5643

  • Make InMemoryCache#evict remove data from all EntityStore layers.
    @benjamn in #5773

  • Stop paying attention to previousResult in InMemoryCache.
    @benjamn in #5644

  • Improve optimistic update performance by limiting cache key diversity.
    @benjamn in #5648

  • Custom field read functions can read from neighboring fields using the readField(fieldName) helper, and may also read fields from other entities by calling readField(fieldName, objectOrReference).
    @benjamn in #5651

  • Expose cache modify and identify to the mutate update function.
    @hwillson in #5956

  • Add a default gc implementation to ApolloCache.
    @justinwaite in #5974

React

  • [BREAKING] The QueryOptions, MutationOptions, and SubscriptionOptions React Apollo interfaces have been renamed to QueryDataOptions, MutationDataOptions, and SubscriptionDataOptions (to avoid conflicting with similarly named and exported Apollo Client interfaces).

  • [BREAKING] Results with loading: true will no longer redeliver previous data, though they may provide partial data from the cache, when available.
    @benjamn in #6566

  • [BREAKING?] Remove fixPolyfills.ts, except when bundling for React Native. If you have trouble with Map or Set operations due to frozen key objects in React Native, either update React Native to version 0.59.0 (or 0.61.x, if possible) or investigate why fixPolyfills.native.js is not included in your bundle.
    @benjamn in #5962

  • The contents of the @apollo/react-hooks package have been merged into @apollo/client, enabling the following all-in-one import:

    import { ApolloClient, ApolloProvider, useQuery } from '@apollo/client';

    @hwillson in #5357

  • React SSR features (previously accessed via @apollo/react-ssr) can now be accessed from the separate Apollo Client entry point of @apollo/client/react/ssr. These features are not included in the default @apollo/client bundle.
    @hwillson in #6499

General

  • [BREAKING] Removed graphql-anywhere since it's no longer used by Apollo Client.
    @hwillson in #5159

  • [BREAKING] Removed apollo-boost since Apollo Client 3.0 provides a boost like getting started experience out of the box.
    @hwillson in #5217

  • [BREAKING] We are no longer exporting certain (intended to be) internal utilities. If you are depending on some of the lesser known exports from apollo-cache, apollo-cache-inmemory, or apollo-utilities, they may no longer be available from @apollo/client.
    @hwillson in #5437 and #5514

    Utilities that were previously externally available through the apollo-utilities package are now only available by importing from @apollo/client/utilities.
    @hwillson in #5683

  • Make sure all graphql-tag public exports are re-exported.
    @hwillson in #5861

  • Fully removed prettier. The Apollo Client team has decided to no longer automatically enforce code formatting across the codebase. In most cases existing code styles should be followed as much as possible, but this is not a hard and fast rule.
    @hwillson in #5227

  • Make sure ApolloContext plays nicely with IE11 when storing the shared context.
    @ms in #5840

  • Migrated React Apollo HOC and Components functionality into Apollo Client, making it accessible from @apollo/client/react/components and @apollo/client/react/hoc entry points.
    @hwillson in #6558

  • Support passing a context object through the link execution chain when using subscriptions.
    @sgtpepper43 in #4925

  • MockSubscriptionLink now supports multiple subscriptions.
    @dfrankland in #6081

Bug Fixes

  • useMutation adjustments to help avoid an infinite loop / too many renders issue, caused by unintentionally modifying the useState based mutation result directly.
    @hwillson in #5770

  • Missing __typename fields no longer cause the InMemoryCache#diff result to be marked complete: false, if those fields were added by InMemoryCache#transformDocument (which calls addTypenameToDocument).
    @benjamn in #5787

  • Fixed an issue that allowed @client @export based queries to lead to extra unnecessary network requests being fired.
    @hwillson in #5946

  • Refined useLazyQuery types to help prevent runtime errors.
    @benmosher in #5935

  • Make sure @client @export variables used in watched queries are updated each time the query receives new data that changes the value of the @export variable.
    @hwillson in #5986

  • Ensure useMutation passes a defined errorPolicy option into its underlying ApolloClient.mutate() call.
    @jamesreggio in #5863

  • useQuery: Prevent new data re-render attempts during an existing render. This helps avoid React 16.13.0's "Cannot update a component from inside the function body of a different component" warning (facebook/react#17099).
    @hwillson in #6107

  • Expand ApolloError typings to include ServerError and ServerParseError.
    @dmarkow in #6319

  • Fast responses received over the link chain will no longer conflict with skip settings.
    @hwillson in #6587

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

Apollo Client (2.6.4)

Apollo Client (2.6.4)

Apollo Client (2.6.3)

Apollo Client (2.6.3)

Apollo Client (2.6.1)

Apollo Utilities 1.3.2

  • Reimplement isEqual without pulling in massive lodash.isequal.
    @benjamn in #4924

Apollo Client (2.6.1)

  • In all Apollo Client packages, the compilation of lib/bundle.esm.js to lib/bundle.cjs.js and lib/bundle.umd.js now uses Babel instead of Rollup, since Babel correctly compiles some edge cases that neither Rollup nor TypeScript compile correctly.
    @benjamn in #4911

Apollo Cache In-Memory 1.6.1

  • Pretend that __typename exists on the root Query when matching fragments.
    @benjamn in #4853

Apollo Utilities 1.3.1

  • The isEqual function has been reimplemented using the lodash.isequal npm package, to better support circular references. Since the lodash.isequal package is already used by react-apollo, this change is likely to decrease total bundle size.
    @capaj in #4915

Apollo Client (2.6.0)

  • 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.
    Issue #3130 (comment) and commit cf069bc7

  • Avoid updating (and later invalidating) cache watches when fetchPolicy is 'no-cache'.
    @bradleyayers in PR #4573, part of issue #3452

  • Remove temporary queryId after fetchMore completes.
    @doomsower in #4440

  • Call clearStore callbacks after clearing store.
    @ds8k in #4695

  • Perform all DocumentNode transforms once, and cache the results.
    @benjamn in #4601

  • Accommodate @client @export variable changes in ObservableQuery.
    @hwillson in #4604

  • Support the returnPartialData option for watched queries again.
    @benjamn in #4743

  • Preserve networkStatus for incomplete cache-and-network queries.
    @benjamn in #4765

  • Preserve cache-and-network fetchPolicy when refetching.
    @benjamn in #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.
    @hwillson in #4531

  • Polling queries are no longer batched together, so their scheduling should be more predictable.
    @benjamn in #4800

Apollo Cache In-Memory 1.6.0

  • Support new InMemoryCache({ freezeResults: true }) to help enforce immutability.
    @benjamn in #4514

  • Allow IntrospectionFragmentMatcher to match fragments against the root Query, as HeuristicFragmentMatcher does.
    @rynobax in #4620

  • Rerential identity (===) of arrays in cache results will now be preserved for unchanged data.
    @benjamn in commit f3091d6a

  • Avoid adding __typename field to @client selection sets that have been @exported as input variables.
    @benjamn in #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).
    @GreenGremlin in #4373

Apollo Client 2.5.1

apollo-client 2.5.1

  • Fixes A tuple type element list cannot be empty issue.
    @benjamn in #4502

graphql-anywhere 4.2.1

  • Adds back the missing graphql-anywhere/lib/async entry point.
    @benjamn in #4503

Apollo Client (2.5.0)

Apollo Client (2.5.0)

  • Introduces new local state management features (client-side schema and local resolver / @client support) and many overall code improvements, to help reduce the Apollo Client bundle size.
    #4361
  • Revamped CJS and ESM bundling approach with Rollup.
    @rosskevin in #4261
  • Fixes an issue where the QueryManager was accidentally returning cached data for network-only queries.
    @danilobuerger in #4352
  • Fixed an issue in the repo .gitattributes that was causing binary files to have their line endings adjusted, and cleaned up corrupted documentation images (ref: apollographql#4232).
    @rajington in #4438
  • Improve (and shorten) query polling implementation.
    PR #4337

Apollo Client (2.4.13)

Apollo Client (2.4.13)

Apollo Client (2.4.12)

Apollo Client (2.4.12)

  • Support ApolloClient#stop method for safe client disposal.
    PR #4336

Apollo Client (2.4.11)

  • Added explicit dependencies on the tslib package to all client packages to fix Issue #4332.

Apollo Client (2.4.11)

  • Reverted some breaking changes accidentally released in a patch version (2.4.10). PR #4334

Apollo Client (2.4.10)

Apollo Client (2.4.10)

  • The apollo-client package no longer exports a printAST function from graphql/language/printer. If you need this functionality, import it directly: import { print } from "graphql/language/printer"

  • Query polling now uses a simpler scheduling strategy based on a single setTimeout interval rather than multiple setInterval timers. The new timer fires at the rate of the fastest polling interval, and queries with longer polling intervals fire whenever the time elapsed since they last fired exceeds their desired interval.
    PR #4243

Apollo Cache In-Memory (1.4.1)

  • The optimism npm package has been updated to a version (0.6.9) that provides its own TypeScript declarations, which should fix problems like Issue #4327.
    PR #4331

  • Error messages involving GraphQL queries now print the queries using JSON.stringify instead of the print function exported by the graphql package, to avoid pulling unnecessary printing logic into your JavaScript bundle.
    PR #4234

  • The QueryKeyMaker abstraction has been removed, meaning that cache results for non-identical queries (or sub-queries) with equivalent structure will no longer be cached together. This feature was a nice optimization in certain specific use cases, but it was not worth the additional complexity or bundle size.
    PR #4245

Apollo Utilities (1.1.1)

  • The flattenSelections helper function is no longer exported from apollo-utilities, since getDirectiveNames has been reimplemented without using flattenSelections, and flattenSelections has no clear purpose now. If you need the old functionality, use a visitor:
    import { visit } from "graphql/language/visitor";
    
    function flattenSelections(selection: SelectionNode) {
      const selections: SelectionNode[] = [];
      visit(selection, {
        SelectionSet(ss) {
          selections.push(...ss.selections);
        }
      });
      return selections;
    }

Apollo Client (2.4.9)

Apollo Client (2.4.9)

Apollo Utilities (1.1.0)

  • Transformation utilities have been refactored to work with graphql 14.x. GraphQL AST's are no longer being directly modified.
    @hwillson in #4233

Apollo Cache In-Memory (1.4.0)

  • The speed and memory usage of optimistic reads and writes has been improved dramatically using a new layering technique that does not require copying the non-optimistic contents of the cache.
    PR #4319

  • The RecordingCache abstraction has been removed, and thus is no longer exported from apollo-cache-inmemory.
    PR #4319

  • Export the optimism wrap function using ES2015 export syntax, instead of CommonJS.
    @ardatan in #4158

Apollo Client (2.4.8)

Apollo Client (2.4.8)

Apollo Cache In-Memory (1.3.12)

  • Avoid using DepTrackingCache for optimistic reads. PR #4521

  • When creating an InMemoryCache object, it's now possible to disable the result caching behavior introduced in #3394, either for diagnostic purposes or because the benefit of caching repeated reads is not worth the extra memory usage in your application:

    new InMemoryCache({
      resultCaching: false
    })

    Part of PR #4521.

Apollo Client (2.4.7)

Apollo Client (2.4.7)

  • The ApolloClient constructor has been updated to accept name and version params, that can be used to support Apollo Server Client Awareness functionality. These client awareness properties are passed into the defined Apollo Link chain, and are then ultimately sent out as custom headers with outgoing requests.
    @hwillson in #4154

Apollo Boost (0.1.22)

  • No changes.

Apollo Cache (1.1.21)

  • No changes.

Apollo Cache In-Memory (1.3.11)

  • No changes.

Apollo Utilities (1.0.26)

  • No changes.

Graphql Anywhere (4.1.23)

  • No changes.

Apollo Client (2.4.6)

Apollo Cache In-Memory (1.3.10)

  • Added some returns to prevent errors with noImplicitReturns TypeScript rule. PR #4137

  • Exclude the src/ directory when publishing apollo-cache-inmemory. Issue #4083

Apollo Client (2.4.5)

Apollo Cache (1.1.20)

Apollo Cache In-Memory (1.3.9)

Apollo Utilities (1.0.25)

  • Fix apollo-utilities isEqual bug due to missing hasOwnProperty check. PR #4072 by @samkline

Apollo Client (2.4.4)

Apollo Utilities (1.0.24)

  • Discard property accessor functions in cloneDeep helper, to fix issue #4034.

  • Unconditionally remove cloneDeep property accessors. PR #4039

  • Avoid copying non-enumerable and/or Symbol keys in cloneDeep. PR #4052

Apollo Cache In-Memory (1.3.7)

Apollo Client (2.4.3)

Apollo Cache In-Memory (1.3.6)

  • Optimize repeated apollo-cache-inmemory reads by caching partial query results, for substantial performance improvements. As a consequence, watched queries will not be rebroadcast unless the data have changed. PR #3394

  • Include root ID and fragment matcher function in cache keys computed by StoreReader#executeStoreQuery and executeSelectionSet, and work around bugs in the React Native Map and Set polyfills. PR #3964 React Native PR #21492 (pending)

  • The apollo-cache-inmemory package now allows graphql@^14.0.0 as a peer dependency. Issue #3978

  • The apollo-cache-inmemory package now correctly broadcasts changes even when the new data is === to the old data, since the contents of the data object may have changed. Issue #3992 PR #4032

Apollo GraphQL Anywhere (4.1.20)

Apollo Utilities (1.0.22)

  • The fclone package has been replaced with a custom cloneDeep implementation that is tolerant of cycles, symbol properties, and non-enumerable properties. PR #4032

Apollo Boost (0.1.17)

Apollo Cache (1.1.18)

  • No changes.

Apollo Client (2.4.2)

Apollo Client (2.4.2)

  • Apollo Client no longer deep freezes query results. @hwillson in #3883
  • A new clearStore method has been added, that will remove all data from the store. Unlike resetStore, it will not refetch active queries after removing store data. @hwillson in #3885

Apollo Utilities (1.0.21)

  • Replace the custom cloneDeep implementation with fclone, to avoid crashing when encountering circular references.
    @hwillson in #3881

Apollo Boost (0.1.16)

  • No changes.

Apollo Cache (1.1.17)

  • No changes.

Apollo Cache In-Memory (1.2.10)

  • No changes.

Apollo GraphQL Anywhere (4.1.19)

  • No changes.

2.4.1 (August 26, 2018)

Apollo Client (2.4.1)

  • mutate's refetchQueries option now allows queries to include a custom context option. This context will be used when refetching the query. For example:

    context = {
      headers: {
        token: 'some auth token',
      },
    };
    client.mutate({
      mutation: UPDATE_CUSTOMER_MUTATION,
      variables: {
        userId: user.id,
        firstName,
        ...
      },
      refetchQueries: [{
        query: CUSTOMER_MESSAGES_QUERY,
        variables: { userId: user.id },
        context,
      }],
      context,
    });

    The CUSTOMER_MESSAGES_QUERY above will be refetched using context. Normally queries are refetched using the original context they were first started with, but this provides a way to override the context, if needed.
    @hwillson in #3852

  • Documentation updates.
    @hwillson in #3841

Apollo Boost (0.1.15)

  • Various internal infrastructure changes related to building, bundling, testing, etc. @hwillson in #3817

Apollo Cache (1.1.16)

  • Various internal infrastructure changes related to building, bundling, testing, etc. @hwillson in #3817

Apollo Cache In-Memory (1.2.9)

  • Various internal infrastructure changes related to building, bundling, testing, etc. @hwillson in #3817

Apollo Utilities (1.0.20)

  • Various internal infrastructure changes related to building, bundling, testing, etc. @hwillson in #3817

Apollo GraphQL Anywhere (4.1.18)

  • Various internal infrastructure changes related to building, bundling, testing, etc. @hwillson in #3817

2.4.0 (August 17, 2018)

Apollo Client (2.4.0)

  • Add proper error handling for subscriptions. If you have defined an error handler on your subscription observer, it will now be called when an error comes back in a result, and the next handler will be skipped (similar to how we're handling errors with mutations). Previously, the error was just passed in the result to the next handler. If you don't have an error handler defined, the previous functionality is maintained, meaning the error is passed in the result, giving the next handler a chance to deal with it. This should help address backwards compatibility (and is the reason for the minor version bumo in this release).
    @clayne11 in #3800
  • Allow an optimistic param to be passed into ApolloClient.readQuery and ApolloClient.readFragment, that when set to true, will allow optimistic results to be returned. Is false by default.
    @jay1337 in #2429
  • Optimistic tests cleanup.
    @joshribakoff in #3713
  • Make sure each package has its own .npmignore, so they're taken into consideration when publishing via lerna.
    @hwillson in #3828
  • Documentation updates.
    @toolness in #3804
    @pungggi in #3798
    @lorensr in #3748
    @joshribakoff in #3730
    @yalamber in #3819
    @pschreibs85 in #3812
    @msreekm in #3808
    @kamaltmo in #3806
    @lorensr in #3739
    @brainkim in #3680

Apollo Cache In-Memory (1.2.8)

  • Fix typo in console.warn regarding fragment matching error message.
    @combizs in #3701

Apollo Boost (0.1.14)

  • No changes.

Apollo Cache (1.1.15)

  • No changes.

Apollo Utilities (1.0.19)

  • No changes.

Apollo GraphQL Anywhere (4.1.17)

  • No changes.

2.3.8 (August 9, 2018)

Apollo Client (2.3.8)

Apollo Boost (0.1.13)

  • No changes.

Apollo Cache In-Memory (1.2.7)

  • No changes.

Apollo Cache (1.1.14)

  • No changes.

Apollo Utilities (1.0.18)

  • No changes.

Apollo GraphQL Anywhere (4.1.16)

  • No changes.

2.3.7 (July 24, 2018)

Apollo Client (2.3.7)

  • Release 2.3.6 broke Typescript compilation. QueryManager's getQueryWithPreviousResult method included an invalid variables return type in the auto-generated core/QueryManager.d.ts declaration file. The type definition had a locally referenced path, that appears to have been caused by the typescript compiler getting confused at compile/publish time. getQueryWithPreviousResult return types are now excplicity identified, which helps Typescript avoid the local type reference. For more details, see apollographql#3729.
    @hwillson in #3731

Apollo Boost (0.1.12)

  • No changes.

2.3.6 (July 24, 2018)

Apollo Client (2.3.6)

Apollo Boost (0.1.11)

  • Allow fetch to be given as a configuration option to ApolloBoost.
    @mbaranovski in #3590
  • The apollo-boost ApolloClient constructor now warns about unsupported options.
    @quentin- in #3551

Apollo Cache (1.1.13)

  • No changes.

Apollo Cache In-Memory (1.2.6)

  • Add __typename and id properties to dataIdFromObject parameter (typescript)
    @jfurler in #3641
  • Fixed an issue caused by dataIdFromObject considering returned 0 values to be falsy, instead of being a valid ID, which lead to the store not being updated properly in some cases.
    @hwillson in #3711

Apollo Utilities (1.0.17)

  • No changes.

Apollo GraphQL Anywhere (4.1.15)

  • Add support for arrays to graphql-anywhere's filter utility.
    @jsweet314 in #3591
  • Fix Cannot convert object to primitive value error that was showing up when attempting to report a missing property on an object.
    @benjie in #3618

2.3.5 (June 19, 2018)

Apollo Client (2.3.5)

Apollo Boost (0.1.10)

  • No changes.

Apollo Cache (1.1.12)

  • No changes.

Apollo Cache In-Memory (1.2.5)

  • No changes.

Apollo Utilities (1.0.16)

Apollo GraphQL Anywhere (4.1.14)

  • No changes.

2.3.4 (June 13, 2018)

Apollo Client (2.3.4)

  • Export the QueryOptions interface, to make sure it can be used by other projects (like apollo-angular).
  • Fixed an issue caused by typescript changes to the constructor defaultOptions param, that prevented query defaults from passing type checks. (@hwillson in #3585)

Apollo Boost (0.1.9)

  • No changes

Apollo Cache (1.1.11)

  • No changes

Apollo Cache In-Memory (1.2.4)

  • No changes

Apollo Utilities (1.0.15)

  • No changes

Apollo GraphQL Anywhere (4.1.13)

  • No changes

2.3.3 (June 13, 2018)

Apollo Client (2.3.3)

  • Typescript improvements. Made observable query parameterized on data and variables: ObservableQuery<TData, TVariables> (@excitement-engineer in #3140)
  • Added optional generics to cache manipulation methods (typescript). (@mvestergaard in #3541)
  • Typescript improvements. Created a new QueryOptions interface that is now used by ApolloClient.query options, instead of the previous WatchQueryOptions interface. This helps reduce confusion (especially in the docs) that made it look like ApolloClient.query accepted ApolloClient.watchQuery only options, like pollingInterval. (@hwillson in #3569)

Apollo Boost (0.1.8)

  • Allow cache to be given as a configuration option to ApolloBoost. (@dandean in #3561)
  • Allow headers and credentials to be passed in as configuration parameters to the apollo-boost ApolloClient constructor. (@rzane in #3098)

Apollo Cache (1.1.10)

  • Added optional generics to cache manipulation methods (typescript). (@mvestergaard in #3541)

Apollo Cache In-Memory (1.2.3)

  • Added optional generics to cache manipulation methods (typescript). (@mvestergaard in #3541)
  • Restore non-enumerability of resultFields[ID_KEY]. (@benjamn in #3544)
  • Cache query documents transformed by InMemoryCache. (@benjamn in #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 in #2869)
  • Avoid needless hasOwnProperty check in deepFreeze. (@benjamn in #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 in #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 in #3500)
  • Fixed an issue involving Object.setPrototypeOf() not working on JSC (Android), by instead setting the prototype of this manually. (@seklyza in #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 in #3367, @doomsower in #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 in #3507)
  • Fixed cache invalidation for inlined mixed types in union fields within arrays. (@dferber90 in #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 in #3418)
  • Remove certain small internal caches to prevent memory leaks when using SSR. (@brunorzn in #3444)

Apollo GraphQL Anywhere (4.1.11)

  • Source files are now excluded when publishing to npm. (@hwillson in #3454)