Skip to content

@apollo/client@4.0.0-alpha.22

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 13 Jun 17:47
· 6 commits to main since this release
ddf196a

Major Changes

  • #12673 cee90ab Thanks @phryneas! - The includeExtensions option of HttpLink and BatchHttpLink now defaults
    to true.

    If includeExtensions is true, but extensions is not set or empty, extensions
    will not be included in outgoing requests.

  • #12673 cee90ab Thanks @phryneas! - The ApolloClient constructor options name and version that are used to
    configure the client awareness feature have moved onto a clientAwareness key.

    const client = new ApolloClient({
      // ..
    -  name: "my-app",
    -  version: "1.0.0",
    +  clientAwareness: {
    +    name: "my-app",
    +    version: "1.0.0",
    +  },
    });
  • #12690 5812759 Thanks @phryneas! - Aliasing any other field to __typename is now forbidden.

  • #12690 5812759 Thanks @phryneas! - Aliasing a field to an alias beginning with __ac_ is now forbidden - this namespace is now reserved for internal use.

  • #12673 cee90ab Thanks @phryneas! - Adds enhanced client awareness to the client.

    HttpLink and BatchHttpLink will now per default send information about the
    client library you are using in extensions.

    This could look like this:

    {
      "query": "query GetUser($id: ID!) { user(id: $id) { __typename id name } }",
      "variables": {
        "id": 5
      },
      "extensions": {
        "clientLibrary": {
          "name": "@apollo/client",
          "version": "4.0.0"
        }
      }
    }

    This feature can be disabled by passing enhancedClientAwareness: { transport: false } to your
    ApolloClient, HttpLink or BatchHttpLink constructor options.

Minor Changes

  • #12698 be77d1a Thanks @phryneas! - Adjusted the accept header for multipart requests according to the new GraphQL over HTTP spec with these changes:

    -multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json
    +multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/graphql-response+json,application/json;q=0.9
    -multipart/mixed;deferSpec=20220824,application/json
    +multipart/mixed;deferSpec=20220824,application/graphql-response+json,application/json;q=0.9
  • #12673 cee90ab Thanks @phryneas! - Add the new ClientAwarenessLink.

    This link is already included in HttpLink and BatchHttpLink to enable the
    "client awareness" and "enhanced client awareness" features, but you can also use
    ClientAwarenessLink directly in your link chain to combine it with other
    terminating links.

    If you want to save the bundle size that ClientAwarenessLink adds to HttpLink
    and BatchHttpLink, you can use BaseHttpLink or BaseBatchHttpLink instead.
    These links come without the ClientAwarenessLink included.

    For example:

    import {
      ApolloClient,
    -  HttpLink,
    } from "@apollo/client";
    +import { BaseHttpLink } from "@apollo/client/link/http";
    
    const client = new ApolloClient({
    -  link: new HttpLink({
    +  link: new BaseHttpLink({
        uri,
      }),
      cache: new InMemoryCache(),
    });
  • #12698 be77d1a Thanks @phryneas! - Adds an accept option to HttpOptions that allows to add additional Accept headers to be merged in without overriding user-specified or default accept headers.

Patch Changes

  • #12673 cee90ab Thanks @phryneas! - Fixed a bug in PersistedQueryLink where the persistedQuery extension would still be sent after a PersistedQueryNotSupported if includeExtensions was enabled on HttpLink.