New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/client

Package Overview
Dependencies
Maintainers
4
Versions
604
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client - npm Package Versions

2345
61

4.0.0-alpha.1

Diff
apollo-bot
published 4.0.0-alpha.1 •
apollo-bot
published 4.0.0-alpha.0 •
apollo-bot
published 3.13.4 •

Changelog

Source

3.13.4

Patch Changes

apollo-bot
published 3.13.3 •

Changelog

Source

3.13.3

Patch Changes

  • #12362 f6d387c Thanks @jerelmiller! - Fixes an issue where calling observableQuery.getCurrentResult() when the errorPolicy was set to all would return the networkStatus as NetworkStatus.ready when there were errors returned in the result. This has been corrected to report NetworkStatus.error.

    This bug also affected the useQuery and useLazyQuery hooks and may affect you if you check for networkStatus in your component.

apollo-bot
published 3.13.2 •

Changelog

Source

3.13.2

Patch Changes

  • #12409 6aa2f3e Thanks @phryneas! - To mitigate problems when Apollo Client ends up more than once in the bundle, some unique symbols were converted into Symbol.for calls.

  • #12392 644bb26 Thanks @Joja81! - Fixes an issue where the DeepOmit type would turn optional properties into required properties. This should only affect you if you were using the omitDeep or stripTypename utilities exported by Apollo Client.

  • #12404 4332b88 Thanks @jerelmiller! - Show NaN rather than converting to null in debug messages from MockLink for unmatched variables values.

apollo-bot
published 3.13.1 •

Changelog

Source

3.13.1

Patch Changes

apollo-bot
published 3.13.0 •

Changelog

Source

3.13.0

Minor Changes

  • #12066 c01da5d Thanks @jerelmiller! - Adds a new useSuspenseFragment hook.

    useSuspenseFragment suspends until data is complete. It is a drop-in replacement for useFragment when you prefer to use Suspense to control the loading state of a fragment. See the documentation for more details.

  • #12174 ba5cc33 Thanks @jerelmiller! - Ensure errors thrown in the onCompleted callback from useMutation don't call onError.

  • #12340 716d02e Thanks @phryneas! - Deprecate the onCompleted and onError callbacks of useQuery and useLazyQuery. For more context, please see the related issue on GitHub.

  • #12276 670f112 Thanks @Cellule! - Provide a more type-safe option for the previous data value passed to observableQuery.updateQuery. Using it could result in crashes at runtime as this callback could be called with partial data even though its type reported the value as a complete result.

    The updateQuery callback function is now called with a new type-safe previousData property and a new complete property in the 2nd argument that determines whether previousData is a complete or partial result.

    As a result of this change, it is recommended to use the previousData property passed to the 2nd argument of the callback rather than using the previous data value from the first argument since that value is not type-safe. The first argument is now deprecated and will be removed in a future version of Apollo Client.

    observableQuery.updateQuery(
      (unsafePreviousData, { previousData, complete }) => {
        previousData;
        // ^? TData | DeepPartial<TData> | undefined
    
        if (complete) {
          previousData;
          // ^? TData
        } else {
          previousData;
          // ^? DeepPartial<TData> | undefined
        }
      }
    );
    
  • #12174 ba5cc33 Thanks @jerelmiller! - Reject the mutation promise if errors are thrown in the onCompleted callback of useMutation.

Patch Changes

  • #12276 670f112 Thanks @Cellule! - Fix the return type of the updateQuery function to allow for undefined. updateQuery had the ability to bail out of the update by returning a falsey value, but the return type enforced a query value.

    observableQuery.updateQuery(
      (unsafePreviousData, { previousData, complete }) => {
        if (!complete) {
          // Bail out of the update by returning early
          return;
        }
    
        // ...
      }
    );
    
  • #12296 2422df2 Thanks @Cellule! - Deprecate option ignoreResults in useMutation. Once this option is removed, existing code still using it might see increase in re-renders. If you don't want to synchronize your component state with the mutation, please use useApolloClient to get your ApolloClient instance and call client.mutate directly.

  • #12338 67c16c9 Thanks @phryneas! - In case of a multipart response (e.g. with @defer), query deduplication will now keep going until the final chunk has been received.

  • #12276 670f112 Thanks @Cellule! - Fix the type of the variables property passed as the 2nd argument to the subscribeToMore callback. This was previously reported as the variables type for the subscription itself, but is now properly typed as the query variables.

apollo-bot
published 3.13.0-rc.0 •

Changelog

Source

3.13.0-rc.0

Minor Changes

  • #12066 c01da5d Thanks @jerelmiller! - Adds a new useSuspenseFragment hook.

    useSuspenseFragment suspends until data is complete. It is a drop-in replacement for useFragment when you prefer to use Suspense to control the loading state of a fragment.

  • #12174 ba5cc33 Thanks @jerelmiller! - Ensure errors thrown in the onCompleted callback from useMutation don't call onError.

  • #12340 716d02e Thanks @phryneas! - Deprecate the onCompleted and onError callbacks of useQuery and useLazyQuery. For more context, please see the related issue on GitHub.

  • #12276 670f112 Thanks @Cellule! - Provide a more type-safe option for the previous data value passed to observableQuery.updateQuery. Using it could result in crashes at runtime as this callback could be called with partial data even though its type reported the value as a complete result.

    The updateQuery callback function is now called with a new type-safe previousData property and a new complete property in the 2nd argument that determines whether previousData is a complete or partial result.

    As a result of this change, it is recommended to use the previousData property passed to the 2nd argument of the callback rather than using the previous data value from the first argument since that value is not type-safe. The first argument is now deprecated and will be removed in a future version of Apollo Client.

    observableQuery.updateQuery(
      (unsafePreviousData, { previousData, complete }) => {
        previousData;
        // ^? TData | DeepPartial<TData> | undefined
    
        if (complete) {
          previousData;
          // ^? TData
        } else {
          previousData;
          // ^? DeepPartial<TData> | undefined
        }
      }
    );
    
  • #12174 ba5cc33 Thanks @jerelmiller! - Reject the mutation promise if errors are thrown in the onCompleted callback of useMutation.

Patch Changes

  • #12276 670f112 Thanks @Cellule! - Fix the return type of the updateQuery function to allow for undefined. updateQuery had the ability to bail out of the update by returning a falsey value, but the return type enforced a query value.

    observableQuery.updateQuery(
      (unsafePreviousData, { previousData, complete }) => {
        if (!complete) {
          // Bail out of the update by returning early
          return;
        }
    
        // ...
      }
    );
    
  • #12296 2422df2 Thanks @Cellule! - Deprecate option ignoreResults in useMutation. Once this option is removed, existing code still using it might see increase in re-renders. If you don't want to synchronize your component state with the mutation, please use useApolloClient to get your ApolloClient instance and call client.mutate directly.

  • #12338 67c16c9 Thanks @phryneas! - In case of a multipart response (e.g. with @defer), query deduplication will now keep going until the final chunk has been received.

  • #12276 670f112 Thanks @Cellule! - Fix the type of the variables property passed as the 2nd argument to the subscribeToMore updateQuery callback. This was previously reported as the variables type for the subscription itself, but is now properly typed as the query variables.

apollo-bot
published 3.12.11 •

Changelog

Source

3.12.11

Patch Changes

  • #12351 3da908b Thanks @jerelmiller! - Fixes an issue where the wrong networkStatus and loading value was emitted from observableQuery when calling fetchMore with a no-cache fetch policy. The networkStatus now properly reports as ready and loading as false after the result is returned.

  • #12354 a24ef94 Thanks @phryneas! - Fix missing main.d.cts file

apollo-bot
published 3.12.10 •

Changelog

Source

3.12.10

Patch Changes

  • #12341 f2bb0b9 Thanks @phryneas! - useReadQuery/useQueryRefHandlers: Fix a "hook order" warning that might be emitted in React 19 dev mode.

  • #12342 219b26b Thanks @phryneas! - Add graphql-ws ^6.0.3 as a valid peerDependency

2345
61