Skip to content

Releases: apollographql/apollo-client

v3.6.9

29 Sep 23:49
f75de97
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Leave fetchPolicy unchanged when skip: true (or in standby) and nextFetchPolicy is available, even if variables change.
    @benjamn in #9823

What's Changed

  • removes deprecation language by @jpvajda in #9825
  • Leave fetchPolicy unchanged when skip: true (or in standby) and nextFetchPolicy is available by @benjamn in #9823

Full Changelog: v3.6.8...v3.6.9

v3.6.8

13 Jun 16:31
6bd651b
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Fix incorrect variables passed in FieldFunctionOptions for nested readField calls in read and merge functions.
    @stardustxx in #9808

  • Improve repository build scripts to work better on Windows.
    @dylanwulf in #9805

  • Ensure useQuery(query, { skip: true }).called === false rather than always returning called as true.
    @KucharskiPiotr in #9798

  • Allow abandoned reobserve requests to unsubscribe from their underlying Observable.
    @javier-garcia-meteologica in #9791

What's Changed (auto-generated by GitHub)

New Contributors 🎉 🙌 🥳

Full Changelog: v3.6.7...v3.6.8

v3.6.7

10 Jun 17:52
83935e8
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Fix regression (introduced in v3.6.0) that caused BatchHttpLink to discard pending batched queries on early completion of the underlying Observable.
    @benjamn in #9793

What's Changed (auto-generated by GitHub)

Full Changelog: v3.6.6...v3.6.7

v3.6.6

10 Jun 17:50
a9226c1
Compare
Choose a tag to compare

What's Changed (auto-generated by GitHub)

  • Allow useLazyQuery(query, { defaultOptions }) to benefit from defaultOptions.variables by @benjamn in #9762

Full Changelog: v3.6.5...v3.6.6

v3.6.5

23 May 22:28
b86c363
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Restore pre-v3.6 variables replacement behavior of ObservableQuery#reobserve method, fixing a regression that prevented removal of variables.
    @benjamn in #9741

  • Preserve previousData even when different query or client provided to useQuery, instead of resetting previousData to undefined in those cases, matching behavior prior to v3.6.0.
    @benjamn in #9734

  • Fix bug where onCompleted() and onError() are stale for useMutation().
    @charle692 in #9740

  • Limit scope of DeepMerger object reuse, and avoid using Object.isFrozen, which can introduce differences between development and production if objects that were frozen using Object.freeze in development are left unfrozen in production.
    @benjamn in #9742

  • Properly merge variables from original useLazyQuery(query, { variables }) with variables passed to execution function.
    @benjamn in #9758

What's Changed (auto-generated by GitHub)

  • Preserve previousData even when different client or query passed to useQuery by @benjamn in #9734
  • Restore pre-v3.6 variables replacement behavior of ObservableQuery#reobserve method by @benjamn in #9741
  • Clarify modifying response data in link docs by @hatched-kade in #9430
  • adds documentation on file uploads by @jpvajda in #9744
  • Fix improper syntax with spread operator by @mongodben in #9441
  • Reduce confusion about the query component by @jpvajda in #9747
  • Fix bug where onCompleted and onError are stale for useMutation. onCompleted and onError could not be changed while a mutation is executing. by @charle692 in #9740
  • Restrict DeepMerger mutable object reuse to fix subtle production-only bug by @benjamn in #9742
  • Merge variables from original useLazyQuery(query, { variables }) with variables passed to execution function by @benjamn in #9758

New Contributors

Full Changelog: v3.6.4...v3.6.5

v3.6.4

16 May 23:08
a46240f
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Guarantee Concast cleanup without Observable cancelled prematurely rejection, potentially solving long-standing issues involving that error.
    @benjamn in #9701

  • Ensure useSubscription subscriptions are properly restarted after unmounting/remounting by React 18 in <StrictMode>.
    @kazekyo in #9707

Improvements (from CHANGELOG.md)

  • Internalize useSyncExternalStore shim, for more control than use-sync-external-store provides, fixing some React Native issues.
    @benjamn in #9675 and #9709

  • Provide @apollo/client/**/*.cjs.native.js versions of every @apollo/client/**/*.cjs bundle (including dependencies ts-invariant and zen-observable-ts) to help React Native's Metro bundler automatically resolve CommonJS entry point modules. These changes should render unnecessary the advice we gave in the v3.5.4 section below about metro.config.js.
    @benjamn in #9716

  • Handle falsy incoming data more gracefully in offetLimitPagination().merge function.
    @shobhitsharma in #9705

What's Changed (auto-generated by GitHub)

New Contributors

Full Changelog: v3.6.3...v3.6.4

v3.6.3

16 May 23:05
265abe2
Compare
Choose a tag to compare

Bug Fixes (from CHANGELOG.md)

  • Simplify useQuery(query, { defaultOptions }) default options processing in order to fix bug where skip: true queries failed to execute upon switching to skip: false.
    @benjamn in #9665

  • Add tests of skipping/unskipping and useLazyQuery with defaultOptions, and fix a bug causing duplicate requests.
    @benjamn in #9666

  • Update ts-invariant to version 0.10.2 to fix source map warnings.
    @benjamn in #9672

  • Test that useQuery queries with skip: true do not stall server-side rendering.
    @nathanmarks and @benjamn in #9677

  • Prevent useLazyQuery from making duplicate requests when its execution function is first called, and stop rejecting the Promise it returns when result.error is defined.
    @benjamn in #9684

  • Fix issue with useQuery returning loading: true state during server-side rendering with skip: true.
    @nathanmarks in #9679

What's Changed (auto-generated by GitHub)

  • Drastically simplify useQuery default options processing by @benjamn in #9665
  • Docs: fix typo in subscriptions.mdx by @pobch in #9663
  • Update ts-invariant to version 0.10.2 to fix source map warnings by @benjamn in #9672
  • Update queries.mdx by @anilpai in #5466
  • Fix failing regression test for skipped SSR useQuery stuck in standby by @benjamn in #9677
  • Add a comment about a new use of the content-type header by @glasser in #9683
  • Add missing assumeImmutableResults documentation by @henryqdineen in #9680
  • Prevent useLazyQuery from making duplicate requests when execution function first called by @benjamn in #9684
  • Fix issue with useQuery returning loading: true state during server-side rendering with skip: true by @nathanmarks in #9679
  • Add description & example of how to handle multiple parameters in read() when declaring typePolicies. by @Moristotle in #6755
  • Add link to ts-transform-graphql-tag in the performance docs by @hcharley in #5608

New Contributors

Full Changelog: v3.6.2...v3.6.3

3.6.2

03 May 00:16
1edccee
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v3.6.1...v3.6.2

v3.6.1

28 Apr 21:31
8389767
Compare
Choose a tag to compare

What's Changed

  • Remove WatchQueryOptions["fetchBlockingPromise"] option due to regressions by @benjamn in #9636
  • chore(deps): update dependency graphql-ws to v5.8.1 by @renovate in #9592
  • Update Full-stack tutorial links to point to Odyssey by @rkoron007 in #9610
  • changes the way the parser filters the array of definitions by @rasulomaroff in #9622
  • chore: updates roadmap by @jpvajda in #9628

New Contributors

Full Changelog: v3.6.0...v3.6.1

3.6.0

26 Apr 21:06
04a35d5
Compare
Choose a tag to compare

Note: for the most up-to-date version of this information, see CHANGELOG.md

Apollo Client 3.6.0 (2022-04-26)

Potentially disruptive changes

  • Calling fetchMore for queries using the cache-and-network or network-only fetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using the cache-first fetch policy.
    @benjamn in #9504

  • Reimplement useQuery and useLazyQuery to use the proposed useSyncExternalStore API from React 18.
    @brainkim and @benjamn in #8785 and #9596

  • Fixed bug where the useLazyQuery execution function would always use the refetch method of ObservableQuery, instead of properly reapplying the current fetchPolicy using the reobserve method.
    @benjamn in #9564

    Since this reobserve method is useful and used internally, we have now exposed it as use[Lazy]Query(...).reobserve (which optionally takes a Partial<WatchQueryOptions> of new options), to supplement the existing refetch method. Note that reobserve permanently updates the variables and other options of the ObservableQuery, unlike refetch({ ...variables }), which does not save those variables.

  • The internal use of options.fetchBlockingPromise by useQuery and useLazyQuery may slightly delay the delivery of network results, compared to previous versions of Apollo Client. Since network results are already delivered asynchronously, these timing differences should not be disruptive in most cases. Nevertheless, please open an issue if the timing differences cause problems for your applications.
    @benjamn in #9599

React 18

In both its peerDependencies and its internal implementation, Apollo Client v3.6 should no longer prevent you from updating to React 18 in your applications.

Internally, we have refactored useQuery and useLazyQuery to be implemented in terms of React's new (shimmable) useSyncExternalStore hook, demonstrating Apollo Client can serve as an external store with a referentially stable, synchronous API, as needed by React.

As part of this refactoring, we also improved the behavior of useQuery and useLazyQuery when used in <React.StrictMode>, which double-renders components in development. While this double-rendering always results in calling useQuery twice, forcing Apollo Client to create and then discard an unnecessary ObservableQuery object, we now have multiple defenses in place against executing any network queries for the unused ObservableQuery objects.

In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling our server-side rendering utilities (getDataFromTree et al.), and introducing suspenseful versions of our hooks, to take full advantage of the new patterns React 18+ enables for data management libraries like Apollo Client.

Improvements

  • Allow BatchLink to cancel queued and in-flight operations.
    @PowerKiKi and @benjamn in #9248

  • Add GraphQLWsLink in @apollo/client/link/subscriptions. This link is similar to the existing WebSocketLink in @apollo/client/link/ws, but uses the newer graphql-ws package and protocol instead of the older subscriptions-transport-ws implementation. This functionality was technically first released in @apollo/[email protected], but semantically belongs in the 3.6.0 minor version.
    @glasser in #9369

  • Allow passing defaultOptions to useQuery to avoid clobbering/resetting existing options when useQuery is called repeatedly.
    @benjamn in #9563, superseding #9223

  • Provide additional context to nextFetchPolicy functions to assist with fetchPolicy transitions. More details can be found in the nextFetchPolicy documentation.
    @benjamn in #9222

  • Remove nagging deprecation warning about passing an options.updateQuery function to fetchMore.
    @benjamn in #9504

  • Let addTypenameToDocument take any ASTNode (including DocumentNode, as before).
    @benjamn in #9595

  • Set useMutation internal isMounted variable to true again when component remounted.
    @devpeerapong in #9561

New Contributors