Skip to content

Commit 454ec78

Browse files
authored
Don't export gql from /react entrypoint (#12775)
1 parent 978dda6 commit 454ec78

File tree

6 files changed

+11
-17
lines changed

6 files changed

+11
-17
lines changed

.api-reports/api-report-react.api.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import type { FormattedExecutionResult } from 'graphql';
3030
import type { FragmentType } from '@apollo/client/masking';
3131
import { getApolloClientMemoryInternals } from '@apollo/client/utilities/internal';
3232
import type { GetDataState as GetDataState_2 } from '@apollo/client';
33-
import { gql } from '@apollo/client';
3433
import type { GraphQLRequest } from '@apollo/client/link';
3534
import type { HKT } from '@apollo/client/utilities';
3635
import type { HookWrappers } from '@apollo/client/react/internal';
@@ -325,8 +324,6 @@ type GetDataState<TData, TState extends DataState<TData>["dataState"]> = Extract
325324
dataState: TState;
326325
}>;
327326

328-
export { gql }
329-
330327
// Warning: (ae-forgotten-export) The symbol "InternalRefetchQueryDescriptor" needs to be exported by the entry point index.d.ts
331328
// Warning: (ae-forgotten-export) The symbol "RefetchQueriesIncludeShorthand" needs to be exported by the entry point index.d.ts
332329
//

.changeset/mighty-jobs-drum.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@apollo/client-codemod-migrate-3-to-4": patch
3+
"@apollo/client": patch
4+
---
5+
6+
Don't export `gql` from `@apollo/client/react` entrypoint. Import from `@apollo/client` instead.

.size-limits.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43696,
3-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38670,
4-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33351,
5-
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27632
2+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 43672,
3+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38614,
4+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 33360,
5+
"import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27603
66
}

scripts/codemods/ac3-to-ac4/src/imports.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,7 @@ const transform: Transform = function transform(file, api) {
192192
sourceEntrypoint: string,
193193
targetEntrypoint: string
194194
) {
195-
if (
196-
areAllSpecifiersFrom(
197-
specifiers.concat(specifiers === REACT_IMPORTS_FROM_ROOT ? "gql" : []),
198-
sourceEntrypoint
199-
) &&
200-
!isOnlySpecifier("gql", sourceEntrypoint)
201-
) {
195+
if (areAllSpecifiersFrom(specifiers, sourceEntrypoint)) {
202196
renameImport(sourceEntrypoint, targetEntrypoint);
203197
} else {
204198
specifiers.forEach((name) =>

src/__tests__/__snapshots__/exports.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ Array [
283283
"ApolloProvider",
284284
"createQueryPreloader",
285285
"getApolloContext",
286-
"gql",
287286
"reactCompilerVersion",
288287
"skipToken",
289288
"useApolloClient",

src/react/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export { gql } from "@apollo/client";
2-
31
export type { ApolloContextValue } from "./context/ApolloContext.js";
42
export { ApolloConsumer } from "./context/ApolloConsumer.js";
53
export { getApolloContext } from "./context/ApolloContext.js";

0 commit comments

Comments
 (0)