-
Notifications
You must be signed in to change notification settings - Fork 2.7k
remove react/context|hooks|parser entry points, remove parser utils completely
#12513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
06aedd0
b6313a9
52e88a2
89e8344
386c604
d3dc528
f276087
a576770
ca9089b
9c3d2ee
5fa99bd
9c083d3
8e78835
ad863f4
cfba9a9
19ef2c9
69636a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@apollo/client": major | ||
| --- | ||
|
|
||
| Removed the `@apollo/client/react/context` and `@apollo/client/react/hooks` entry points. Please use `@apollo/client/react` instead. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@apollo/client": patch | ||
| --- | ||
|
|
||
| Removed the `parser` cache. The functionality has been replaced in a way that doesn't need caching. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@apollo/client": major | ||
| --- | ||
|
|
||
| Removed the `@apollo/client/react/parser` entry point. There is no replacement. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 42953, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38324, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 32954, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27724 | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (CJS)": 42819, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production) (CJS)": 38357, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\"": 32736, | ||
| "import { ApolloClient, InMemoryCache, HttpLink } from \"@apollo/client\" (production)": 27747 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { Trie } from "@wry/trie"; | ||
| import type { DocumentNode } from "graphql"; | ||
| import { OperationTypeNode } from "graphql"; | ||
| import type { Subscription } from "rxjs"; | ||
| import { | ||
| catchError, | ||
|
|
@@ -32,7 +33,7 @@ import { execute } from "@apollo/client/link/core"; | |
| import type { MaybeMasked, Unmasked } from "@apollo/client/masking"; | ||
| import { maskFragment, maskOperation } from "@apollo/client/masking"; | ||
| import type { DeepPartial } from "@apollo/client/utilities"; | ||
| import { print } from "@apollo/client/utilities"; | ||
| import { checkDocument, print } from "@apollo/client/utilities"; | ||
| import { AutoCleanedWeakCache, cacheSizes } from "@apollo/client/utilities"; | ||
| import { | ||
| addNonReactiveToNamedFragments, | ||
|
|
@@ -102,9 +103,6 @@ import type { | |
|
|
||
| const { hasOwnProperty } = Object.prototype; | ||
|
|
||
| // TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means we have to drop GraphQL 15 compat, which we probably should do anyways.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| type OperationTypeNode = any; | ||
|
|
||
| const IGNORE = {} as IgnoreModifier; | ||
|
|
||
| interface MutationStoreValue { | ||
|
|
@@ -276,6 +274,8 @@ export class QueryManager { | |
| "mutation option is required. You must specify your GraphQL document in the mutation option." | ||
| ); | ||
|
|
||
| checkDocument(mutation, OperationTypeNode.MUTATION); | ||
|
|
||
| invariant( | ||
| fetchPolicy === "network-only" || fetchPolicy === "no-cache", | ||
| "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write." | ||
|
|
@@ -788,6 +788,8 @@ export class QueryManager { | |
| T, | ||
| TVariables extends OperationVariables = OperationVariables, | ||
| >(options: WatchQueryOptions<TVariables, T>): ObservableQuery<T, TVariables> { | ||
| checkDocument(options.query, OperationTypeNode.QUERY); | ||
|
|
||
| const query = this.transform(options.query); | ||
|
|
||
| // assign variable default values if supplied | ||
|
|
@@ -824,6 +826,8 @@ export class QueryManager { | |
| options: QueryOptions<TVars, TData>, | ||
| queryId = this.generateQueryId() | ||
| ): Promise<QueryResult<MaybeMasked<TData>>> { | ||
| checkDocument(options.query, OperationTypeNode.QUERY); | ||
|
|
||
| const query = this.transform(options.query); | ||
|
|
||
| return this.fetchQuery<TData, TVars>(queryId, { ...options, query }) | ||
|
|
@@ -1027,6 +1031,8 @@ export class QueryManager { | |
| extensions = {}, | ||
| } = options; | ||
|
|
||
| checkDocument(query, OperationTypeNode.SUBSCRIPTION); | ||
|
|
||
| query = this.transform(query); | ||
| variables = this.getVariables(query, variables); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,13 @@ import { invariant } from "@apollo/client/utilities/invariant"; | |
|
|
||
| import { getApolloContext } from "./ApolloContext.js"; | ||
|
|
||
| export interface ApolloConsumerProps { | ||
| children: (client: ApolloClient) => ReactTypes.ReactNode; | ||
| declare namespace ApolloConsumer { | ||
| export interface Props { | ||
| children: (client: ApolloClient) => ReactTypes.ReactNode; | ||
| } | ||
|
Comment on lines
+9
to
+12
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was previously exported from Same for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be called out in the changelog?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh., I don't think anyone ever used those - it would probably be more noise than it would be worth. |
||
| } | ||
|
|
||
| export const ApolloConsumer: ReactTypes.FC<ApolloConsumerProps> = (props) => { | ||
| export const ApolloConsumer: ReactTypes.FC<ApolloConsumer.Props> = (props) => { | ||
| const ApolloContext = getApolloContext(); | ||
| return ( | ||
| <ApolloContext.Consumer> | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is not really nice, it looks like "removed" here and then merges in a removed entry point with the same exports further down.