Skip to content

Releases: apollographql/apollo-client

@apollo/[email protected]

05 Dec 21:02
73cc591

Choose a tag to compare

Pre-release

Minor Changes

@apollo/[email protected]

03 Dec 01:36
db71fb4

Choose a tag to compare

Pre-release

Minor Changes

@apollo/[email protected]

01 Dec 19:38
4a6c100

Choose a tag to compare

Pre-release

Patch Changes

  • #13026 05eee67 Thanks @jerelmiller! - Reduce the number of observables created by watchFragment by reusing existing observables as much as possible. This should improve performance when watching the same item in the cache multiple times after a cache update occurs.

@apollo/[email protected]

19 Nov 01:20
b0f9f97

Choose a tag to compare

Pre-release

Patch Changes

  • #13010 7627000 Thanks @jerelmiller! - Fix an issue where errors parsed from incremental chunks in ErrorLink might throw when using the GraphQL17Alpha9Handler.

  • #13010 7627000 Thanks @jerelmiller! - Handle @stream payloads that send multiple items in the same chunk when using the Defer20220824Handler.

  • #13010 7627000 Thanks @jerelmiller! - Handle an edge case with the Defer20220824Handler where an error for a @stream item that bubbles to the @stream boundary (such as an item returning null for a non-null array item) would write items from future chunks to the wrong array index. In these cases, the @stream field is no longer processed and future updates to the field are ignored. This prevents runtime errors that TypeScript would otherwise not be able to catch.

@apollo/[email protected]

17 Nov 21:21
55016b8

Choose a tag to compare

Major Changes

@apollo/[email protected]

17 Nov 18:31
a617c10

Choose a tag to compare

Pre-release

Patch Changes

  • #13009 259ae9b Thanks @phryneas! - Allow FragmentType not only to be called as FragmentType<TData>, but also as FragmentType<TypedDocumentNode>.

  • #13012 44706a2 Thanks @phryneas! - Add helper type QueryRef.ForQuery<TypedDocumentNode>

@apollo/[email protected]

31 Oct 17:11
3f84c78

Choose a tag to compare

Patch Changes

  • #12993 8f3bc9b Thanks @jerelmiller! - Fix an issue where switching from options with variables to skipToken with useSuspenseQuery and useBackgroundQuery would create a new ObservableQuery. This could cause unintended refetches where variables were absent in the request when the query was referenced with refetchQueries.

@apollo/[email protected]

27 Oct 17:59
977f7ff

Choose a tag to compare

Patch Changes

@apollo/[email protected]

17 Nov 17:37

Choose a tag to compare

Pre-release

Minor Changes

  • #12971 d11eb40 Thanks @jerelmiller! - Add support for from: null in client.watchFragment and cache.watchFragment. When from is null, the emitted result is:

    {
      data: null,
      dataState: "complete",
      complete: true,
    }
  • #12971 d11eb40 Thanks @jerelmiller! - Add support for arrays with useFragment, useSuspenseFragment, and client.watchFragment. This allows the ability to use a fragment to watch multiple entities in the cache. Passing an array to from will return data as an array where each array index corresponds to the index in the from array.

    function MyComponent() {
      const result = useFragment({
        fragment,
        from: [item1, item2, item3],
      });
    
      // `data` is an array with 3 items
      console.log(result); // { data: [{...}, {...}, {...}], dataState: "complete", complete: true }
    }
  • #12971 d11eb40 Thanks @jerelmiller! - Add a getCurrentResult function to the observable returned by client.watchFragment and cache.watchFragment that returns the current value for the watched fragment.

    const observable = client.watchFragment({
      fragment,
      from: { __typename: "Item", id: 1 },
    });
    
    console.log(observable.getCurrentResult());
    // {
    //   data: {...},
    //   dataState: "complete",
    //   complete: true,
    // }

Patch Changes

  • #12971 d11eb40 Thanks @jerelmiller! - Deduplicate watches created by useFragment, client.watchFragment, and cache.watchFragment that contain the same fragment, variables, and identifier. This should improve performance in situations where a useFragment or a client.watchFragment is used to watch the same object in multiple places of an application.

  • #12982 5c56b32 Thanks @jerelmiller! - Ignore top-level data values on subsequent chunks in incremental responses.

  • #12982 5c56b32 Thanks @jerelmiller! - Fix the Defer20220824Handler.SubsequentResult type to match the FormattedSubsequentIncrementalExecutionResult type in [email protected].

  • #12973 072da24 Thanks @jerelmiller! - Update the accept header used with the GraphQL17Alpha9Handler to multipart/mixed;incrementalSpec=v0.2 to ensure the newest incremental delivery format is requested.

  • #12971 d11eb40 Thanks @jerelmiller! - DeepPartial<Array<TData>> now returns Array<DeepPartial<TData>> instead of Array<DeepPartial<TData | undefined>>.

@apollo/[email protected]

17 Nov 17:38

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.