Skip to content
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

add deprecation warnings for HOC and Render Prop docblocks #11443

Merged
merged 5 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .api-reports/api-report-react_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type Modifiers<T extends Record<string, any> = Record<string, unknown>> = Partia
[FieldName in keyof T]: Modifier<StoreObjectValueMaybeReference<Exclude<T[FieldName], undefined>>>;
}>;

// @public (undocumented)
// @public @deprecated (undocumented)
export function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
Expand Down Expand Up @@ -1214,7 +1214,7 @@ type OperationVariables = Record<string, any>;
// @public (undocumented)
type Path = ReadonlyArray<string | number>;

// @public (undocumented)
// @public @deprecated (undocumented)
export function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
Expand Down Expand Up @@ -1617,7 +1617,7 @@ type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVaria
context?: DefaultContext;
};

// @public (undocumented)
// @public @deprecated (undocumented)
export function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): ReactTypes.JSX.Element | null;

// @public (undocumented)
Expand Down
10 changes: 5 additions & 5 deletions .api-reports/api-report-react_hoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ const getApolloClientMemoryInternals: (() => {
};
}) | undefined;

// @public (undocumented)
// @public @deprecated (undocumented)
export function graphql<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> & Partial<MutateProps<TData, TGraphQLVariables>>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// @public (undocumented)
Expand Down Expand Up @@ -1666,21 +1666,21 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
variables?: TVariables;
}

// @public (undocumented)
// @public @deprecated (undocumented)
export function withApollo<TProps, TResult = any>(WrappedComponent: ReactTypes.ComponentType<WithApolloClient<Omit<TProps, "client">>>, operationOptions?: OperationOption<TProps, TResult>): ReactTypes.ComponentClass<Omit<TProps, "client">>;

// @public (undocumented)
export type WithApolloClient<P> = P & {
client?: ApolloClient<any>;
};

// @public (undocumented)
// @public @deprecated (undocumented)
export function withMutation<TProps extends TGraphQLVariables | {} = {}, TData extends Record<string, any> = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps = MutateProps<TData, TGraphQLVariables>, TContext extends Record<string, any> = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// @public (undocumented)
// @public @deprecated (undocumented)
export function withQuery<TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// @public (undocumented)
// @public @deprecated (undocumented)
export function withSubscription<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends object = {}, TChildProps extends object = DataProps<TData, TGraphQLVariables>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: ReactTypes.ComponentType<TProps & TChildProps>) => ReactTypes.ComponentClass<TProps>;

// Warnings were encountered during analysis:
Expand Down
8 changes: 8 additions & 0 deletions .changeset/chatty-comics-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@apollo/client": patch
---

Adds a deprecation warning to the HOC and render prop APIs.

The HOC and render prop APIs have already been deprecated since 2020,
but we previously didn't have a @deprecated tag in the DocBlocks.
6 changes: 6 additions & 0 deletions src/react/components/Mutation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type { OperationVariables } from "../../core/index.js";
import type { MutationComponentOptions } from "./types.js";
import { useMutation } from "../hooks/index.js";

/**
* @deprecated
* Official support for React Apollo render prop components ended in March 2020.
* This library is still included in the `@apollo/client` package,
* but it no longer receives feature updates or bug fixes.
*/
export function Mutation<TData = any, TVariables = OperationVariables>(
props: MutationComponentOptions<TData, TVariables>
): ReactTypes.JSX.Element | null {
Expand Down
6 changes: 6 additions & 0 deletions src/react/components/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type { OperationVariables } from "../../core/index.js";
import type { QueryComponentOptions } from "./types.js";
import { useQuery } from "../hooks/index.js";

/**
* @deprecated
* Official support for React Apollo render prop components ended in March 2020.
* This library is still included in the `@apollo/client` package,
* but it no longer receives feature updates or bug fixes.
*/
export function Query<
TData = any,
TVariables extends OperationVariables = OperationVariables,
Expand Down
6 changes: 6 additions & 0 deletions src/react/components/Subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type { OperationVariables } from "../../core/index.js";
import type { SubscriptionComponentOptions } from "./types.js";
import { useSubscription } from "../hooks/index.js";

/**
* @deprecated
* Official support for React Apollo render prop components ended in March 2020.
* This library is still included in the `@apollo/client` package,
* but it no longer receives feature updates or bug fixes.
*/
export function Subscription<
TData = any,
TVariables extends OperationVariables = OperationVariables,
Expand Down
5 changes: 5 additions & 0 deletions src/react/hoc/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { withSubscription } from "./subscription-hoc.js";
import type { OperationOption, DataProps, MutateProps } from "./types.js";
import type { OperationVariables } from "../../core/index.js";

/**
* @deprecated
* Official support for React Apollo higher order components ended in March 2020.
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
*/
export function graphql<
TProps extends TGraphQLVariables | {} = {},
TData extends object = {},
Expand Down
5 changes: 5 additions & 0 deletions src/react/hoc/mutation-hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import {
import type { OperationOption, OptionProps, MutateProps } from "./types.js";
import type { ApolloCache } from "../../core/index.js";

/**
* @deprecated
* Official support for React Apollo higher order components ended in March 2020.
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
*/
export function withMutation<
TProps extends TGraphQLVariables | {} = {},
TData extends Record<string, any> = {},
Expand Down
5 changes: 5 additions & 0 deletions src/react/hoc/query-hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import {
} from "./hoc-utils.js";
import type { OperationOption, OptionProps, DataProps } from "./types.js";

/**
* @deprecated
* Official support for React Apollo higher order components ended in March 2020.
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
*/
export function withQuery<
TProps extends TGraphQLVariables | Record<string, any> = Record<string, any>,
TData extends object = {},
Expand Down
5 changes: 5 additions & 0 deletions src/react/hoc/subscription-hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import {
} from "./hoc-utils.js";
import type { OperationOption, OptionProps, DataProps } from "./types.js";

/**
* @deprecated
* Official support for React Apollo higher order components ended in March 2020.
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
*/
export function withSubscription<
TProps extends TGraphQLVariables | {} = {},
TData extends object = {},
Expand Down
5 changes: 5 additions & 0 deletions src/react/hoc/withApollo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ function getDisplayName<P>(WrappedComponent: ReactTypes.ComponentType<P>) {
return WrappedComponent.displayName || WrappedComponent.name || "Component";
}

/**
* @deprecated
* Official support for React Apollo higher order components ended in March 2020.
* This library is still included in the `@apollo/client` package, but it no longer receives feature updates or bug fixes.
*/
export function withApollo<TProps, TResult = any>(
WrappedComponent: ReactTypes.ComponentType<
WithApolloClient<Omit<TProps, "client">>
Expand Down
Loading