Skip to content

Releases: apollographql/apollo-client

@apollo/[email protected]

14 Aug 16:38
2c4fd8b

Choose a tag to compare

Pre-release

Major Changes

  • #12840 83e132a Thanks @phryneas! - If you use an incremental delivery handler, you now have to explicitly opt into adding the chunk types to the ApolloLink.Result type.

    import { Defer20220824Handler } from "@apollo/client/incremental";
    
    declare module "@apollo/client" {
      export interface TypeOverrides extends Defer20220824Handler.TypeOverrides {}
    }
  • #12841 65b503f Thanks @jerelmiller! - Remove the DataMasking interface exported from @apollo/client and @apollo/client/masking.

@apollo/[email protected]

13 Aug 10:48
7a14c90

Choose a tag to compare

Pre-release

Major Changes

  • #12837 7c49fdc Thanks @jerelmiller! - You must now opt in to use GraphQL Codegen data masking types when using Apollo Client's data masking feature. By default, Apollo Client now uses an identity type to apply to masked/unmasked types.

    If you're using GraphQL Codegen to generate masked types, opt into the GraphQL Codegen masked types using declaration merging on the TypeOverides interface.

    import { GraphQLCodegenDataMasking } from "@apollo/client/masking";
    
    declare module "@apollo/client" {
      export interface TypeOverrides
        extends GraphQLCodegenDataMasking.TypeOverrides {}
    }
  • #12837 7c49fdc Thanks @jerelmiller! - The types mode for data masking has been removed. Adding a types mode to the DataMasking interface has no effect. Remove the mode key in the module where you declare the DataMasking type for the @apollo/client module.

    As a result, the Masked and MaskedDocumentNode types have also been removed since these have no effect when types are preserved.

@apollo/[email protected]

07 Aug 01:56
fb3d8ff

Choose a tag to compare

Pre-release

Minor Changes

  • #12828 81b03d8 Thanks @phryneas! - invariant.error will now also log in production builds, not only dev builds

Patch Changes

  • #12822 103664d Thanks @jerelmiller! - Ensure HttpLink.ContextOptions and BatchHttpLink.ContextOptions include ClientAwarenessLink.ContextOptions.

  • #12650 2a32ac6 Thanks @phryneas! - Fix a situation where a passed-in AbortSignal would override internal unsubscription cancellation behaviour.

@apollo/[email protected]

05 Aug 16:50
ede7e0c

Choose a tag to compare

Pre-release

Major Changes

  • #12825 292b949 Thanks @jerelmiller! - The serializeFetchParameter helper is no longer exported and JSON.stringify is used directly. As such, the ClientParseError type has also been removed in favor of throwing any JSON serialize errors directly.

  • #12824 0506f12 Thanks @jerelmiller! - Ensure the error argument for the delay and attempts functions on RetryLink are an ErrorLike.

  • #12823 19e315e Thanks @jerelmiller! - Move all 1st party link types into a namespace.

  • #12823 19e315e Thanks @jerelmiller! - The OperationBatcher class is no longer exported from @apollo/client/link/batch. It is an implementation detail of BatchLink and should not be relied on directly.

Patch Changes

  • #12824 0506f12 Thanks @jerelmiller! - RetryLink now emits a next event instead of an error event when encountering a protocol errors for multipart subscriptions when the operation is not retried. This ensures the observable notification remains the same as when RetryLink is not used.

  • #12819 7ff548d Thanks @jerelmiller! - update type of HttpLink.Options.fetchOptions to RequestInit

  • #12820 fba3d9e Thanks @jerelmiller! - The fetchOptions option provided to HttpLink and BatchHttpLink is now RequestInit instead of any. The credentials option is now a RequestCredentials type instead of a string.

  • #12823 19e315e Thanks @jerelmiller! - Fix the type of the argument for the sha256 function for PersistedQueryLink from ...any[] to string.

  • #12821 223a409 Thanks @jerelmiller! - Add a deprecation warning to WebSocketLink.

@apollo/[email protected]

01 Aug 15:43
c8cffe7

Choose a tag to compare

Pre-release

Major Changes

  • #12809 e2a0be8 Thanks @jerelmiller! - operation.getContext now returns a Readonly<OperationContext> type.

  • #12809 e2a0be8 Thanks @jerelmiller! - The ApolloLink.Request (i.e. GraphQLRequest) passed to ApolloLink.execute no longer accepts operationName and operationType options. These properties are derived from the query and set on the returned ApolloLink.Operation type.

  • #12808 8e31a23 Thanks @phryneas! - HTTP Multipart handling will now throw an error if the connection closed before the final boundary has been received.
    Data after the final boundary will be ignored.

  • #12809 e2a0be8 Thanks @jerelmiller! - operation.operationType is now a non-null OperationTypeNode. It is now safe to compare this value without having to check for undefined.

  • #12809 e2a0be8 Thanks @jerelmiller! - operation.operationName is now set as string | undefined where undefined represents an anonymous query. Previously operationName would return an empty string as the operationName for anonymous queries.

  • #12809 e2a0be8 Thanks @jerelmiller! - The concat, from, and split functions on ApollLink no longer support a plain request handler function. Please wrap the request handler with new ApolloLink.

    const link = new ApolloLink(/* ... */);
    
    link.concat(
    - (operation, forward) => forward(operation),
    + new ApolloLink((operation, forward) => forward(operation)),
    );
  • #12809 e2a0be8 Thanks @jerelmiller! - transformOperation and validateOperation have been removed and are no longer exported from @apollo/client/link/utils. These utilities have been merged into the implementation of createOperation. As a result, createOperation now returns a well-formed Operation object. Previously createOperation relied on an external call to transformOperation to provide a well-formed Operation type. If you use createOperation directly, remove the calls to transformOperation and validateOperation and pass the request directly.

  • #12809 e2a0be8 Thanks @jerelmiller! - The request handler provided to ApolloLink must now return an Observable. null is no longer supported as a valid return value. If you rely on null so that ApolloLink provides an empty observable, use the EMPTY observable from RxJS instead:

    import { ApolloLink } from "@apollo/client";
    + import { EMPTY } from "rxjs";
    
    const link = new ApolloLink((operation, forward) => {
    - return null;
    + return EMPTY;
    });

    If you have a custom link that overrides the request method, remove null from the return signature:

    class MyCustomLink extends ApolloLink {
      request(
        operation: ApolloLink.Operation,
        forward: ApolloLink.ForwardFunction,
    - ): Observable<ApolloLink.Result> | null {
    + ): Observable<ApolloLink.Result> {
        // implementation
      }
    }
  • #12809 e2a0be8 Thanks @jerelmiller! - createOperation no longer accepts context as the first argument. Instead make sure context is set as the context property on the request passed to createOperation.

    createOperation(
    - startingContext,
    - { query },
    + { query, context: startingContext },
      { client }
    );
  • #12809 e2a0be8 Thanks @jerelmiller! - Remove the TVariables generic argument on the GraphQLRequest type.

  • #12809 e2a0be8 Thanks @jerelmiller! - The context object returned from operation.getContext() is now frozen to prevent mutable changes to the object which could result in subtle bugs. This applies to the previousContext object passed to the operation.setContext() callback as well.

  • #12809 e2a0be8 Thanks @jerelmiller! - The forward function passed to the request handler is now always provided to request and no longer optional. If you create custom links by subclassing ApolloLink, the forward function no longer needs to be optional:

    class CustomLink extends ApolloLink {
      request(
        operation: ApolloLink.Operation,
        // This no longer needs to be typed as optional
        forward: ApolloLink.ForwardFunction
      ) {
        // ...
      }
    }

    As a result of this change, ApolloLink no longer detects terminating links by checking function arity on the request handler. This means using methods such as concat on a terminating link no longer emit a warning. On the flip side, if the terminating link calls the forward function, a warning is emitted and an observable that immediately completes is returned which will result in an error from Apollo Client.

Minor Changes

  • #12809 e2a0be8 Thanks @jerelmiller! - ApolloLink's concat method now accepts multiple links to concatenate together.

    const first = new ApolloLink();
    
    const link = first.concat(second, third, fouth);
  • #12809 e2a0be8 Thanks @jerelmiller! - Many of the types exported from @apollo/client/link now live on the ApolloLink namespace. The old types are now deprecated in favor of the namespaced types.

    • FetchResult -> ApolloLink.Result
    • GraphQLRequest -> ApolloLink.Request
    • NextLink -> ApolloLink.ForwardFunction
    • Operation -> ApolloLink.Operation
    • RequestHandler -> ApolloLink.RequestHandler
  • #12809 e2a0be8 Thanks @jerelmiller! - The static ApolloLink.concat method is now deprecated in favor of ApolloLink.from. ApolloLink.concat is now an alias for ApolloLink.from so prefer ApolloLink.from instead.

Patch Changes

  • #12809 e2a0be8 Thanks @jerelmiller! - The individual empty, concat, from and split functions exported from @apollo/client/link are now deprecated in favor of using the static functions instead.

    import {
      ApolloLink,
    - concat,
    - empty,
    - from,
    - split,
    } from "@apollo/client/link";
    
    - concat(first, second);
    + ApolloLink.concat(first, second);
    
    - empty();
    + ApolloLink.empty();
    
    - from([first, second]);
    + ApolloLink.from([first, second]);
    
    - split(
    + ApolloLink.split(
      (operation) => /* */,
      first,
      second
    );

v3.13.9

29 Jul 14:56
5c202cf

Choose a tag to compare

Patch Changes

  • #12804 32c9aa9 Thanks @phryneas! - Fix a possible race condition on queries that were reobserved before they were subscribed to the first time.

@apollo/[email protected]

28 Jul 16:24
0a2d0f4

Choose a tag to compare

Pre-release

Major Changes

Patch Changes

  • #12782 742b3a0 Thanks @jerelmiller! - Move ApolloClient, ObservableQuery, and ApolloCache.watchFragment method options and result types into namespaces. The old types are now exported as deprecated.

@apollo/[email protected]

18 Jul 20:55
8c8734a

Choose a tag to compare

Pre-release

Major Changes

  • #12776 bce9b74 Thanks @jerelmiller! - Report masked fragments as complete even when a nested masked fragment contains partial data.

  • #12774 511b4f3 Thanks @jerelmiller! - Apply document transforms before reading data from the cache for client.readQuery, client.readFragment, client.watchFragment, useFragment, and useSuspenseFragment.

    NOTE: This change does not affect the equivalent cache.* APIs. To read data from the cache without first running document transforms, run cache.readQuery, cache.readFragment, etc.

Minor Changes

Patch Changes

  • #12776 bce9b74 Thanks @jerelmiller! - cache.watchFragment now returns an Unmasked<TData> result since cache.watchFragment does not mask fragment spreads.

  • #12370 0517163 Thanks @phryneas! - InMemoryCache: Fields with an empty argument object are now saved the same way as fields without arguments.

    Previously, it was possible that the reponses for these two queries would be stored differently in the cache:

    query PlainAccess {
      myField
    }

    would be stored as myField
    and

    query AccessWithoutOptionalArgument($optional: String) {
      myField(optional: $optional)
    }

    would be stored as myField({"optional":"Foo"}) if called with {optional: "Foo"} and as myField({}) if called without the optional argument.

    The cases myField and myField({}) are equivalent from the perspective of a GraphQL server, and so in the future both of these will be stored as myField in the cache.

  • #12775 454ec78 Thanks @jerelmiller! - Don't export gql from @apollo/client/react entrypoint. Import from @apollo/client instead.

  • #12761 db6f7c3 Thanks @phryneas! - Deprecate second argument to readFragment and readQuery - optimistic should be passed as part of the object in the first argument instead.

@apollo/[email protected]

18 Jul 20:55
8c8734a

Choose a tag to compare

Pre-release

Patch Changes

  • #12775 454ec78 Thanks @jerelmiller! - Don't export gql from @apollo/client/react entrypoint. Import from @apollo/client instead.

@apollo/[email protected]

08 Jul 17:48
978dda6

Choose a tag to compare

Pre-release

Minor Changes