Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented May 19, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@apollo/client (source) 0.0.0-pr-10888-20230517165635 -> 3.7.17 age adoption passing confidence

Release Notes

apollographql/apollo-client (@​apollo/client)

v3.7.17

Compare Source

Patch Changes

v3.7.16

Compare Source

Patch Changes

v3.7.15

Compare Source

Patch Changes
  • #​10891 ab42a5c08 Thanks @​laverdet! - Fixes a bug in how multipart responses are read when using @defer. When reading a multipart body, HttpLink no longer attempts to parse the boundary (e.g. "---" or other boundary string) within the response data itself, only when reading the beginning of each mulitpart chunked message.

  • #​10789 23a4e1578 Thanks @​phryneas! - Fix a bug where other fields could be aliased to __typename or id, in which case an incoming result would be merged into the wrong cache entry.

v3.7.14

Compare Source

Patch Changes
  • #​10764 1b0a61fe5 Thanks @​phryneas! - Deprecate useFragment returnPartialData option

  • #​10810 a6252774f Thanks @​dleavitt! - Fix type signature of ServerError.

    In <3.7 HttpLink and BatchHttpLink would return a ServerError.message of e.g. "Unexpected token 'E', \"Error! Foo bar\" is not valid JSON" and a ServerError.result of undefined in the case where a server returned a >= 300 response code with a response body containing a string that could not be parsed as JSON.

    In >=3.7, message became e.g. Response not successful: Received status code 302 and result became the string from the response body, however the type in ServerError.result was not updated to include the string type, which is now properly reflected.

v3.7.13

Compare Source

Patch Changes
  • #​10805 a5503666c Thanks @​phryneas! - Fix a potential memory leak in SSR scenarios when many persistedQuery instances were created over time.

  • #​10718 577c68bdd Thanks @​Hsifnus! - Delay Concast subscription teardown slightly in useSubscription to prevent unexpected Concast teardown when one useSubscription hook tears down its in-flight Concast subscription immediately followed by another useSubscription hook reusing and subscribing to that same Concast

v3.7.12

Compare Source

Patch Changes

v3.7.11

Compare Source

Patch Changes
  • #​10586 4175af594 Thanks @​alessbell! - Improve WebSocket error handling for generic Event received on error. For more information see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event.

  • #​10411 152baac34 Thanks @​lovasoa! - Simplify error message generation and make 'undefined' an impossible message string.

  • #​10592 cdb98ae08 Thanks @​alessbell! - Adds support for multipart subscriptions in HttpLink.

  • #​10698 38508a251 Thanks @​jerelmiller! - Changes the behavior of useLazyQuery introduced in #​10427 where unmounting a component before a query was resolved would reject the promise with an abort error. Instead, the promise will now resolve naturally with the result from the request.

    Other notable fixes:

    • Kicking off multiple requests in parallel with the execution function will now ensure each returned promise is resolved with the data from its request. Previously, each promise was resolved with data from the last execution.
    • Re-rendering useLazyQuery with a different query document will now ensure the execution function uses the updated query document. Previously, only the query document rendered the first time would be used for the request.
  • #​10660 364bee98f Thanks @​alessbell! - Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users.

  • #​10597 8fb9d190d Thanks @​phryneas! - Fix a bug where an incoming cache update could prevent future updates from the active link.

  • #​10629 02605bb3c Thanks @​phryneas! - useQuery: delay unsubscribe to fix race conditions

v3.7.10

Compare Source

Patch Changes
  • #​9438 52a9c8ea1 Thanks @​dciesielkiewicz! - Ensure the client option passed to useMutation's execute function is used when provided. Previously this option was ignored.

  • #​9124 975b923c0 Thanks @​andrebrantom! - Make ApolloClient.writeQuery and ApolloClient.writeFragment behave more like cache.writeQuery and cache.writeFragment by returning the reference returned by the cache.

v3.7.9

Compare Source

Patch Changes
  • #​10560 a561ecf43 Thanks @​benjamn! - Keep __typename fragment when it does not contain @client directive and strip out inline fragments which use a @client directive. Thanks @​Gazler and @​mtsmfm!

  • #​10560 251a12806 Thanks @​benjamn! - Refactor removeDirectivesFromDocument to fix AST ordering sensitivities and avoid 1/3 AST traversals, potentially improving performance for large queries

v3.7.8

Compare Source

Patch Changes
  • #​7555 45562d6fa Thanks @​TheCeloReis! - Adds TVariables generic to GraphQLRequest and MockedResponse interfaces.

  • #​10526 1d13de4f1 Thanks @​benjamn! - Tolerate undefined concast.sources if complete called earlier than concast.start

  • #​10497 8a883d8a1 Thanks @​nevir! - Update SingleExecutionResult and IncrementalPayload's data types such that they no longer include undefined, which was not a valid runtime value, to fix errors when TypeScript's exactOptionalPropertyTypes is enabled.

v3.7.7

Compare Source

Patch Changes
  • #​10502 315faf9ca Thanks @​jerelmiller! - Log a warning to the console when a mock passed to MockedProvider or MockLink cannot be matched to a query during a test. This makes it easier to debug user errors in the mock setup, such as typos, especially if the query under test is using an errorPolicy set to ignore, which makes it difficult to know that a match did not occur.

  • #​10499 9e54f5dfa Thanks @​phryneas! - Allow the execution function returned by useLazyQuery to change the query.

  • #​10362 14a56b105 Thanks @​mccraveiro! - Fix error when server returns an error and we are also querying for a local field

v3.7.6

Compare Source

Patch Changes
  • #​10470 47435e879 Thanks @​alessbell! - Bumps TypeScript to 4.9.4 (previously 4.7.4) and updates types to account for changes in TypeScript 4.8 by propagating contstraints on generic types. Technically this makes some types stricter as attempting to pass null|undefined into certain functions is now disallowed by TypeScript, but these were never expected runtime values in the first place.
    This should only affect you if you are wrapping functions provided by Apollo Client with your own abstractions that pass in their generics as type arguments, in which case you might get an error like error TS2344: Type 'YourGenericType' does not satisfy the constraint 'OperationVariables'. In that case, make sure that YourGenericType is restricted to a type that only accepts objects via extends, like Record<string, any> or @apollo/client's OperationVariables:

    import {
      QueryHookOptions,
      QueryResult,
      useQuery,
    + OperationVariables,
    } from '@&#8203;apollo/client';
    - export function useWrappedQuery<T, TVariables>(
    + export function useWrappedQuery<T, TVariables extends OperationVariables>(
        query: DocumentNode,
        queryOptions: QueryHookOptions<T, TVariables>
      ): QueryResult<T, TVariables> {
        const [execute, result] = useQuery<T, TVariables>(query);
      }
  • #​10408 55ffafc58 Thanks @​zlrlo! - fix: modify BatchHttpLink to have a separate timer for each different batch key

  • #​9573 4a4f48dda Thanks @​vladar! - Improve performance of local resolvers by only executing selection sets that contain an @client directive. Previously, local resolvers were executed even when the field did not contain @client. While the result was properly discarded, the unncessary work could negatively affect query performance, sometimes signficantly.

v3.7.5

Compare Source

Patch Changes

v3.7.4

Compare Source

Patch Changes

v3.7.3

Compare Source

Patch Changes
  • #​10334 7d923939d Thanks @​jerelmiller! - Better handle deferred queries that have cached or partial cached data for them

  • #​10368 46b58e976 Thanks @​alessbell! - Fix: unblocks support for defer in mutations

    If the @defer directive is present in the document passed to mutate, the Promise will resolve with the final merged data after the last multipart chunk has arrived in the response.

v3.7.2

Compare Source

Patch Changes

v3.7.1

Compare Source

Patch Changes

v3.7.0

Compare Source

Minor Changes
  • Implement preview support for the @defer directive.

    @​alessbell and @​benjamn in #​10018

  • Implement useFragment_experimental hook, which represents a lightweight live binding into the ApolloCache, and never triggers network requests of its own.

    @​benjamn in #​8782

  • Allow registering named fragments with InMemoryCache to support using ...NamedFragment in queries without redeclaring NamedFragment repeatedly in every query that uses it.

    @​benjamn in #​9764

  • Support onError callback for useSubscription hook.

    @​jeroenvisser101 in #​9495

  • Implement preserveHeaderCase option for http context object, enabling preserved header capitalization for non-http-spec-compliant servers.

    @​mrdoombringer in #​9891

Patch Changes
  • Delay calling onCompleted and onError callbacks passed to useQuery using Promise.resolve().then(() => ...) to fix issue #​9794.

    @​dylanwulf in #​9823

  • Replace concast.cleanup method with simpler concast.beforeNext API, which promises to call the given callback function just before the next result/error is delivered. In addition, concast.removeObserver no longer takes a quietly?: boolean parameter, since that parameter was partly responsible for cleanup callbacks sometimes not getting called.

    @​benjamn in #​9718

  • Allow preserving header name capitalization when creating an HttpLink with createHttpLink({ uri, preserveHeaderCase: true }). Otherwise, header names are converted to lowercase to prevent case-sensitivity bugs.

    @​MrDoomBringer in #​9891

  • Make queries with a pollInterval respect the no-cache fetch policy, instead of writing polled results into the cache.

    @​MrDoomBringer in #​10020

  • Deprecate the onSubscriptionData callback in favor of a new onData callback for the useSubscription hook. Deprecate the onSubscriptionComplete callback in favor of a new onComplete callback for the useSubscription hook.

    @​jerelmiller in #​10134

Potentially disruptive
  • The optional subscribeAndCount testing utility exported from @apollo/client/testing/core now takes a single generic TResult type parameter, instead of TData. This type will typically be inferred from the observable argument type, but if you have any explicit calls to subscribeAndCount<TData>(...) in your own codebase, you may need to adjust those calls accordingly.

    @​benjamn in #​9718

v3.6.10

Compare Source

Improvements
  • The client options (variables, context, etc.) used for mutation calls are now available as the second argument to the onCompleted and onError callback functions.

    @​MrDoomBringer in #​10052

v3.6.9

Compare Source

Bug Fixes
  • Leave fetchPolicy unchanged when skip: true (or in standby) and nextFetchPolicy is available, even if variables change.

    @​benjamn in #​9823

v3.6.8

Compare Source

Bug Fixes

v3.6.7

Compare Source

Bug Fixes
  • 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

v3.6.6

Compare Source

Bug Fixes
  • Allow useLazyQuery(query, { defaultOptions }) to benefit from defaultOptions.variables and client.defaultOptions.watchQuery.variables merging.

    @​benjamn in #​9762

v3.6.5

Compare Source

Bug Fixes
  • 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

v3.6.4

Compare Source

Bug Fixes
  • 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

v3.6.3

Compare Source

Bug Fixes
  • 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

v3.6.2

Compare Source

Bug Fixes
  • Pass getServerSnapshot function to useSyncExternalStore in addition to getSnapshot, though the two functions behave identically. This change should fix/unbreak React 18 server rendering.

    @​hungphongbk in #​9652
Improvements

v3.6.1

Compare Source

Improvements
  • The client options (variables, context, etc.) used for mutation calls are now available as the second argument to the onCompleted and onError callback functions.

    @​MrDoomBringer in #​10052

v3.6.0

Compare Source

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 are a problem for you (and you have no easy workaround).

    @​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/client@3.5.10, 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

v3.5.10

Compare Source

Improvements
  • 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.

    @​glasser in #​9369

    Note from @​benjamn: since GraphQLWsLink is new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual.

v3.5.9

Compare Source

Improvements
  • Interpret keyFields: [...] and keyArgs: [...] configurations in InMemoryCache type/field policies as ReadonlyArrays, since they are never mutated internally.

    @​julienfouilhe in #​9339

  • Avoid declaring a global type for the __DEV__ constant, to avoid conflict with other such global declarations.

    @​benjamn in #​9386

Bug Fixes
  • Fix useSubscription executing skipped subscription when input changes.

    @​levrik in #​9299

  • Fix partial data appearing in useQuery().data when notifyOnNetworkStatusChange: true.

    @​brainkim in #​9367

  • Prevent Promises returned by useLazyQuery execute functions from causing unhandled Promise rejection errors if uncaught.

    @​brainkim in #​9380

v3.5.8

Compare Source

Bug Fixes
  • Fix the type of the called property returned by useQuery() and useLazyQuery().

    @​sztadii in #​9304
Bug Fixes (by @​brainkim in #​9328)
  • Fix refetch() not being called when skip is true.
  • Fix the promise returned from the useLazyQuery() execution function having stale variables.
  • Fix the promise returned from the useLazyQuery() execution function not rejecting when a query errors.

v3.5.7

Compare Source

Bug Fixes

v3.5.6

Compare Source

Bug Fixes (by @​brainkim in #​9144)
  • Restores old behavior where the callback passed to useMutation() is constant.
  • Fix useMutation() callbacks having stale closures.
  • Fix useQuery() variables being out of date.

v3.5.5

Compare Source

Bug Fixes
  • Remove printer: Printer positional parameter from publicly-exported selectHttpOptionsAndBody function, whose addition in #​8699 was a breaking change (starting in Apollo Client 3.5.0) for direct consumers of selectHttpOptionsAndBody.

    @​benjamn in #​9103

v3.5.4

Compare Source

Notices

⚠️ The following advice about metro.config.js should no longer be necessary, as of Apollo Client v3.6.4.

  • [Relevant if you use Apollo Client with React Native] Since Apollo Client v3.5.0, CommonJS bundles provided by @apollo/client use a .cjs file extension rather than .cjs.js, so Node.js won't interpret them as ECMAScript modules. While this change should be an implementation detail, it may cause problems for the Metro bundler used by React Native, whose resolver.sourceExts configuration does not include the cjs extension by default.

    As a workaround until this issue is resolved, you can configure Metro to understand the .cjs file extension by creating a metro.config.js file in the root of your React Native project:

    // NOTE: No longer necessary in @&#8203;apollo/client@3.6.4!
    const { getDefaultConfig } = require("metro-config");
    const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues();
    exports.resolver = {
      ...defaultResolver,
      sourceExts: [...defaultResolver.sourceExts, "cjs"],
    };
Improvements
  • Restore the ability to pass onError() and onCompleted() to the mutation execution function.
    @​brainkim in #​9076

  • Work around webpack 5 errors of the form
    The request 'ts-invariant/process' failed to resolve only because it was resolved as fully specified
    by ensuring import ... from 'ts-invariant/process' is internally written to import ... from 'ts-invariant/process/index.js'.

    @​benjamn in #​9083

v3.5.3

Compare Source

  • Avoid rewriting non-relative imported module specifiers in config/rewriteModuleIds.ts script, thereby allowing bundlers to resolve those imports as they see fit.

    @​benjamn in #​9073

  • Ensure only current file is matched when running VSCode debugger.

    @​eps1lon in #​9050

v3.5.2

Compare Source

  • Fix useMutation execute function returning non-identical execution functions when passing similar options.

    @​brainkim in #​9037

v3.5.1

Compare Source

Improvements
  • 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.

    @​glasser in #​9369

    Note from @​benjamn: since GraphQLWsLink is new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual.

v3.5.0

Compare Source

Improvements
  • Add updateQuery and updateFragment methods to ApolloCache, simplifying common readQuery/writeQuery cache update patterns.

    @​wassim-k in #​8382

  • Field directives and their arguments can now be included along with field argument names when using field policy keyArgs: [...] notation. For example, if you have a Query.feed field that takes an argument called type and uses a @connection(key:...) directive to keep feed data from different queries separate within the cache, you might configure both using the following InMemoryCache field policy:

    new InMemoryCache({
      typePolicies: {
        Query: {
          fields: {
            feed: {
              keyArgs: ["type", "@&#8203;connection", ["key"]],
            },
          },
        },
      },
    });

    @​benjamn in #​8678

  • Report single MissingFieldError instead of a potentially very large MissingFieldError[] array for incomplete cache reads, improving performance and memory usage.

    @​benjamn in #​8734

  • When writing results into InMemoryCache, each written object is now identified using policies.identify after traversing the fields of the object (rather than before), simplifying identification and reducing duplicate work. If you have custom keyFields functions, they still receive the raw result object as their first parameter, but the KeyFieldsContext parameter now provides context.storeObject (the StoreObject just processed by processSelectionSet) and context.readField (a helper function for reading fields from context.storeObject and any References it might contain, similar to readField for read, merge, and cache.modify functions).

    @​benjamn in #​8996

  • Ensure cache.identify never throws when primary key fields are missing, and include the source object in the error message when keyFields processing fails.

    @​benjamn in #​8679

  • The HttpLink constructor now accepts an optional print function that can be used to customize how GraphQL DocumentNode objects are transformed back into strings before they are sent over the network.

    @​sarahgp in #​8699

  • Make @apollo/client/testing a fully-fledged, independent entry point, instead of re-exporting @apollo/client/utilities/testing (which was never an entry point and no longer exists).

    @​benjamn in #​8769

  • A new nested entry point called @apollo/client/testing/core has been created. Importing from this entry point instead of @apollo/client/testing excludes any React-related dependencies.

    @​wassim-k in #​8687

  • Make cache.batch return the result of calling the options.update function. <b


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/major-apollo-graphql-packages branch from b87a302 to eba1a87 Compare June 1, 2023 08:07
@renovate renovate bot force-pushed the renovate/major-apollo-graphql-packages branch from eba1a87 to b5ae8fd Compare June 21, 2023 23:47
@renovate renovate bot force-pushed the renovate/major-apollo-graphql-packages branch from b5ae8fd to 5fe69f8 Compare July 9, 2023 02:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant