Skip to content

Releases

@apollo/client@4.3.9

Choose a tag to compare

@github-actions github-actions released this 03 Dec 01:51
cb0911b

Patch Changes

  • #13539 1682553 Thanks @jerelmiller! - Fix accidental widening of TVariables type in some APIs that inferred TVariables from the variables option. TVariables is now inferred only from the TypedDocumentNode.

    Affected APIs include:

    • client.readFragment
    • client.writeFragment
    • client.watchFragment
    • client.readQuery
    • client.writeQuery
    • cache.readFragment
    • cache.writeFragment
    • cache.updateFragment
    • cache.watchFragment
    • cache.readQuery
    • cache.writeQuery
    • cache.updateQuery

@apollo/client@4.4.0-alpha.1

Pre-release

Choose a tag to compare

@github-actions github-actions released this 13 Nov 04:46
4d7a1c9

Minor Changes

  • #13522 6f94cfb Thanks @jerelmiller! - Fragment APIs now read fragment arguments and operation variables from the object passed to from. When you pass an object from a query result, you no longer need to pass variables to read the fragment with the correct values.

    const fragment = gql`
      fragment UserCard($avatarSize: Int) on User {
        id
        avatar(size: $avatarSize)
      }
    `;
    
    const query = gql`
      query GetUsers($friendAvatarSize: Int) {
        currentUser {
          ...UserCard(avatarSize: 96)
          friends {
            ...UserCard(avatarSize: $friendAvatarSize)
          }
        }
      }
    `;
    
    const { data } = useQuery(query, { variables: { friendAvatarSize: 32 } });
    
    // Reads the avatar with `size: 96`
    useFragment({ fragment, from: data.currentUser });
    
    // Reads the avatars with `size: 32`
    useFragment({ fragment, from: data.currentUser.friends });

    This works with useFragment, useSuspenseFragment, watchFragment, readFragment, writeFragment, and updateFragment. The same applies to fragments that use operation variables without fragment arguments.

  • #13521 7bd29db Thanks @phryneas! - CombinedGraphQLErrors and CombinedProtocolErrors now extend AggregateError.
    This means that you will need to use at least lib: ["es2021"] or lib: ["es2021.promise"] in your TypeScript configuration.

@apollo/client@4.4.0-alpha.0

Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Nov 23:21
553fa0f

Minor Changes

  • #13508 c1558e3 Thanks @jerelmiller! - Support GraphQL 17 experimental fragment arguments. Fragment definitions can now include variable definitions, and fragment spreads can pass arguments for them.

    fragment UserFragment($avatarSize: Int!) on User {
      id
      avatar(size: $avatarSize)
    }

    Arguments can be passed to the fragment where it's used:

    query CurrentUserQuery($friendAvatarSize: Int!) {
      currentUser {
        id
        ...UserFragment(avatarSize: 32)
    
        friends {
          id
          ...UserFragment(avatarSize: $friendAvatarSize)
        }
      }
    }

    You must enable experimental fragment arguments to use this feature:

    import { enableExperimentalFragmentVariables } from "@apollo/client";
    
    enableExperimentalFragmentVariables();

    [!NOTE]
    This MUST be called before any GraphQL documents are parsed. We recommend calling this in your application's entry file.

@apollo/client@4.3.8

Choose a tag to compare

@github-actions github-actions released this 09 Nov 23:25
96e7beb

Patch Changes

  • #13470 6bc13c8 Thanks @phryneas! - Add a new option, batchHybridRequests to BatchHttpLink. This allows it to combine persisted and non-persisted queries in one shared batch.

@apollo/client@4.3.7

Choose a tag to compare

@github-actions github-actions released this 05 Nov 19:19
0041161

Patch Changes

  • #13518 b302e5a Thanks @jerelmiller! - Fix an issue where an AbortError was thrown by useReadQuery when a useBackgroundQuery query is skipped, its useReadQuery component unmounts, and the query is then re-enabled in the same render that useReadQuery mounts again.

  • #13516 d7cb685 Thanks @trevor-scheer! - Fix a race when chaining refetch and fetchMore calls with useSuspenseQuery inside React transitions.

    For example, an app can refresh the first page of a list with refetch(), then immediately load the next page with fetchMore() from the refetch promise's .then callback. A timer from the completed refetch could make useTransition's isPending become false before the next page arrived, hiding the pending indicator while the list still showed only the first page. Keep the transition pending until the next page is available. This also applies when the first request is another fetchMore().

@apollo/client@4.3.6

Choose a tag to compare

@github-actions github-actions released this 03 Nov 00:56
afe498d

Patch Changes

  • #13484 9462324 Thanks @SunilRathod27! - Exclude "partial" from the dataState union returned from useQuery, useLazyQuery, useSuspenseQuery, useBackgroundQuery, useLoadableQuery, and preloadQuery (createQueryPreloader) when fetchPolicy is "no-cache". This means that dataState is never "partial" when fetchPolicy is "no-cache", regardless of whether returnPartialData is true or false.

  • #13486 165aa72 Thanks @phryneas! - Pass coerced scalars into refetchQueries, updateQueries and update mutation callback options

  • #13487 237a2a1 Thanks @phryneas! - Introduce a warning for missing possibleTypes that might lead to data loss.

  • #13486 165aa72 Thanks @phryneas! - Coerce scalars in no-cache mutations

@apollo/client@4.3.5

Choose a tag to compare

@github-actions github-actions released this 19 Oct 21:23
f3d28a5

Patch Changes

  • #13498 04b12e5 Thanks @jerelmiller! - Fix an issue where custom scalar values that are not JSON-serializable caused errors. These values are properly serialized when used as input for variables or when used as a key field value so that cache writes and calls to cache.identify succeed.

  • #13500 a23ea85 Thanks @jerelmiller! - Require the variables option in useFragment when the fragment has required variables. This matches the behavior of useSuspenseFragment and the query hooks.

  • #13501 303d80f Thanks @kgssystem! - Parse custom scalar fields in subscription results when using the no-cache fetch policy.

@apollo/client@4.3.4

Choose a tag to compare

@github-actions github-actions released this 16 Oct 17:30
91591db

Patch Changes

  • #13497 41d604c Thanks @jerelmiller! - Fix an issue where a list field selected more than once with different selection sets lost the fields that only one of the selections included while a @defer boundary elsewhere in the query was still pending when using the GraphQL17Alpha9Handler. The results of all selections of the list field are now merged.

  • #13457 22746bb Thanks @phryneas! - Fixed a bug where streamFieldInfo might not have been passed into custom merge functions for
    @stream directives that had an aliased field in the path.

  • #13457 22746bb Thanks @phryneas! - Fix Missing field errors being logged when writing @defer results where a parent field is selected both inside and outside of a deferred fragment. Fields whose @defer boundary has not been delivered from the network are no longer reported as missing.

  • #13453 9bb3a41 Thanks @wassim-k! - Unregister the watch when an immediate cache.watch broadcast throws. Previously the watch was added to the cache before its first read, and a read that threw left the watch registered while the caller never received the unsubscribe function, so it could not be removed and every later broadcast ran into the same failing read.

  • #13457 22746bb Thanks @phryneas! - Defer20220824Handler: fix a situation where dataState would show up as completed with incremental errors instead of staying streaming.

@apollo/client@4.3.3

Choose a tag to compare

@github-actions github-actions released this 08 Oct 09:14
4be5c07

Patch Changes

@apollo/client@4.3.2

Choose a tag to compare

@github-actions github-actions released this 05 Oct 21:56
c81455f

Patch Changes

  • #13467 7786771 Thanks @SSpirate11! - Fix an unhandled AbortError promise rejection that occurred when unsubscribing from a multipart HTTP subscription.