Skip to content

Releases: apollographql/apollo-client

@apollo/[email protected]

10 Oct 15:51
f8dab9d

Choose a tag to compare

Pre-release

Minor Changes

  • #12959 556e837 Thanks @jerelmiller! - You can now provide a callback function as the context option on the mutate function returned by useMutation. The callback function is called with the value of the context option provided to the useMutation hook. This is useful if you'd like to merge the context object provided to the useMutation hook with a value provided to the mutate function.

    function MyComponent() {
      const [mutate, result] = useMutation(MUTATION, {
        context: { foo: true },
      });
    
      async function runMutation() {
        await mutate({
          // sends context as { foo: true, bar: true }
          context: (hookContext) => ({ ...hookContext, bar: true }),
        });
      }
    
      // ...
    }

Patch Changes

  • #12954 1c82eaf Thanks @jerelmiller! - Ensure an error is thrown when @stream is detected and an incrementalDelivery handler is not configured.

@apollo/[email protected]

30 Sep 18:53
a3ea1c2

Choose a tag to compare

Patch Changes

@apollo/[email protected]

26 Sep 15:08
c5d5630

Choose a tag to compare

Pre-release

Minor Changes

  • #12934 54ab6d9 Thanks @jerelmiller! - Don't set the fallback value of a @client field to null when a read function is defined. Instead the read function will be called with an existing value of undefined to allow default arguments to be used to set the returned value.

    When a read function is not defined nor is there a defined resolver for the field, warn and set the value to null only in that instance.

  • #12934 54ab6d9 Thanks @jerelmiller! - Add an abstract resolvesClientField function to ApolloCache that can be used by caches to tell LocalState if it can resolve a @client field when a local resolver is not defined.

    LocalState will emit a warning and set a fallback value of null when no local resolver is defined and resolvesClientField returns false, or isn't defined. Returning true from resolvesClientField signals that a mechanism in the cache will set the field value. In this case, LocalState won't set the field value.

Patch Changes

  • #12915 c97b145 Thanks @phryneas! - Create mechanism to add experimental features to Apollo Client

  • #12934 54ab6d9 Thanks @jerelmiller! - Ensure LocalState doesn't try to read from the cache when using a no-cache fetch policy.

  • #12934 54ab6d9 Thanks @jerelmiller! - Warn when using a no-cache fetch policy without a local resolver defined. no-cache queries do not read or write to the cache which meant no-cache queries are silently incomplete when the @client field value was handled by a cache read function.

@apollo/[email protected]

25 Sep 15:29
37555ce

Choose a tag to compare

Patch Changes

  • #12937 3b0d89b Thanks @phryneas! - Fix a problem with fetchMore where the loading state wouldn't reset if the result wouldn't result in a data update.

@apollo/[email protected]

17 Sep 21:21
36e2413

Choose a tag to compare

Pre-release

Minor Changes

  • #12923 2aa31c7 Thanks @jerelmiller! - Fix an issue where deferred payloads that reteurned arrays with fewer items than the original cached array would retain items from the cached array. This change includes @stream arrays where stream arrays replace the cached arrays.

  • #12926 c7fba99 Thanks @jerelmiller! - Support the newer incremental delivery format for the @defer directive implemented in [email protected]. Import the GraphQL17Alpha9Handler to use the newer incremental delivery format with @defer.

    import { GraphQL17Alpha9Handler } from "@apollo/client/incremental";
    
    const client = new ApolloClient({
      // ...
      incrementalHandler: new GraphQL17Alpha9Handler(),
    });

    [!NOTE]
    In order to use the GraphQL17Alpha9Handler, the GraphQL server MUST implement the newer incremental delivery format. You may see errors or unusual behavior if you use the wrong handler. If you are using Apollo Router, continue to use the Defer20220824Handler because Apollo Router does not yet support the newer incremental delivery format.

  • #12918 562e219 Thanks @jerelmiller! - Add support for the @stream directive on both the Defer20220824Handler and the GraphQL17Alpha2Handler.

    [!NOTE]
    The implementations of @stream differ in the delivery of incremental results between the different GraphQL spec versions. If you upgrading from the older format to the newer format, expect the timing of some incremental results to change.

Patch Changes

  • #12925 f538a83 Thanks @jerelmiller! - Fix an issue where calling fetchMore with @defer or @stream would not rerender incremental results as they were streamed.

  • #12923 01cace0 Thanks @jerelmiller! - Improve the cache data loss warning message when existing or incoming is an array.

@apollo/[email protected]

12 Sep 19:29
952325c

Choose a tag to compare

Patch Changes

@apollo/[email protected]

02 Sep 16:52
b3cbb22

Choose a tag to compare

Patch Changes

  • #12892 db8a04b Thanks @jerelmiller! - Prevent unhandled rejections from the promise returned by calling the mutate function from the useMutation hook.

  • #12899 5352c12 Thanks @phryneas! - Fix an issue when invariant is called by external libraries when no dev error message handler is loaded.

  • #12895 71f2517 Thanks @jerelmiller! - Support skipToken with useQuery to provide a more type-safe way to skip query execution.

    import { skipToken, useQuery } from "@apollo/client/react";
    
    // Use `skipToken` in place of `skip: true` for better type safety
    // for required variables
    const { data } = useQuery(QUERY, id ? { variables: { id } } : skipToken);

    Note: this change is provided as a patch within the 4.0 minor version because the changes to TypeScript validation with required variables in version 4.0 made using the skip option more difficult.

  • #12900 c0d5be7 Thanks @phryneas! - Use named export equal instead of default from "@wry/equality"

@apollo/[email protected]

29 Aug 16:28
a65f58d

Choose a tag to compare

Patch Changes

@apollo/[email protected]

27 Aug 16:42
94ed29c

Choose a tag to compare

Patch Changes

@apollo/[email protected]

27 Aug 16:42
94ed29c

Choose a tag to compare

Patch Changes

  • #12879 56b2094 Thanks @phryneas! - Fix an issue where networkStatus would not be moved into the correct package.