Skip to content

Releases: apollographql/apollo-client

@apollo/[email protected]

01 Aug 15:43
c8cffe7
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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
Compare
Choose a tag to compare
Pre-release

Minor Changes

v3.14.0-rc.0

07 Jul 21:14
80414c6
Compare
Choose a tag to compare
v3.14.0-rc.0 Pre-release
Pre-release

Minor Changes

v3.14.0-alpha.1

01 Jul 08:05
45e6ee6
Compare
Choose a tag to compare
v3.14.0-alpha.1 Pre-release
Pre-release

Minor Changes

  • #12752 8b779b4 Thanks @jerelmiller! - Add deprecations and warnings to remaining APIs changed in Apollo Client 4.0.

  • #12751 567cad8 Thanks @jerelmiller! - Add @deprecated tags to all properties returned from any query API (e.g. client.query, observableQuery.refetch, etc.), client.mutate, and client.subscribe that are no longer available in Apollo Client 4.0.

  • #12751 567cad8 Thanks @jerelmiller! - Warn when using a standby fetch policy with client.query.

@apollo/[email protected]

01 Jul 08:08
5ff16fb
Compare
Choose a tag to compare
Pre-release

Major Changes

  • #12731 0198870 Thanks @phryneas! - Ship React Compiler compiled React hooks in @apollo/client/react/compiled.

    We now ship a React-Compiler compiled version of the React hooks in
    @apollo/client/react/compiled.

    This entry point contains everything that @apollo/client/react does,
    so you can use it as a drop-in replacement in your whole application
    if you choose to use the compiled hooks.

Minor Changes

  • #12753 b85818d Thanks @jerelmiller! - Renamed client.reFetchObservableQueries to client.refetchObservableQueries.
    client.reFetchObservableQueries is still available as an alias, but is now
    deprecated and will be removed in a future major version.

v3.14.0-alpha.0

27 Jun 18:24
3e7cfe8
Compare
Choose a tag to compare
v3.14.0-alpha.0 Pre-release
Pre-release

Minor Changes

  • #12746 0bcd2f4 Thanks @jerelmiller! - Add warnings and deprecations for options and methods for all React APIs.

  • #12746 0bcd2f4 Thanks @jerelmiller! - Add preloadQuery.toPromise(queryRef) as a replacement for queryRef.toPromise(). queryRef.toPromise() has been removed in Apollo Client 4.0 in favor of preloadQuery.toPromise and is now considered deprecated.

  • #12736 ea89440 Thanks @jerelmiller! - Add deprecations and deprecation warnings for ApolloClient options and methods.

  • #12459 1c5a031 Thanks @jerelmiller! - Reset addTypenameTransform and fragments caches when calling cache.gc() only when resetResultCache is true.

  • #12743 92ad409 Thanks @jerelmiller! - Add deprecations and warnings for addTypename in InMemoryCache and MockedProvider.

  • #12743 92ad409 Thanks @jerelmiller! - Add deprecations and warnings for canonizeResults.

Patch Changes

  • #12750 ecf3de1 Thanks @phryneas! - Prevent field policies from overwriting/merging into supertype field policies.