From f402485985cc2551b51602c0bff213b7ffb856b9 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 16 May 2023 10:12:53 +0200 Subject: [PATCH] change an import in `useQuery` and `useMutation` that added an unnecessary runtime dependency on @apollo/client/core (#10877) * hooks: untangle imports from core * changeset * Update .changeset/short-feet-relax.md Co-authored-by: Jerel Miller --------- Co-authored-by: Jerel Miller --- .changeset/short-feet-relax.md | 5 +++++ src/react/hooks/useMutation.ts | 2 +- src/react/hooks/useQuery.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/short-feet-relax.md diff --git a/.changeset/short-feet-relax.md b/.changeset/short-feet-relax.md new file mode 100644 index 00000000000..de4174863c8 --- /dev/null +++ b/.changeset/short-feet-relax.md @@ -0,0 +1,5 @@ +--- +'@apollo/client': patch +--- + +Change an import in `useQuery` and `useMutation` that added an unnecessary runtime dependency on `@apollo/client/core`. This drastically reduces the bundle size of each the hooks. diff --git a/src/react/hooks/useMutation.ts b/src/react/hooks/useMutation.ts index 7883d8c3ebd..7f4416c63b3 100644 --- a/src/react/hooks/useMutation.ts +++ b/src/react/hooks/useMutation.ts @@ -15,7 +15,7 @@ import type { OperationVariables} from '../../core'; import { mergeOptions -} from '../../core'; +} from '../../utilities'; import { equal } from '@wry/equality'; import { DocumentType, verifyDocumentType } from '../parser'; import { ApolloError } from '../../errors'; diff --git a/src/react/hooks/useQuery.ts b/src/react/hooks/useQuery.ts index 35957e046f8..34841feaefa 100644 --- a/src/react/hooks/useQuery.ts +++ b/src/react/hooks/useQuery.ts @@ -11,7 +11,7 @@ import { useSyncExternalStore } from './useSyncExternalStore'; import { equal } from '@wry/equality'; import type { OperationVariables, WatchQueryFetchPolicy } from '../../core'; -import { mergeOptions } from '../../core'; +import { mergeOptions } from '../../utilities'; import type { ApolloContextValue} from '../context'; import { getApolloContext } from '../context'; import { ApolloError } from '../../errors';