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 messages to moved exports. #301

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
29 changes: 26 additions & 3 deletions packages/experimental-nextjs-app-support/src/rsc/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
export {
registerApolloClient,
type TransportedQueryRef,
import {
registerApolloClient as _registerApolloClient,
type TransportedQueryRef as _TransportedQueryRef,
} from "@apollo/experimental-nextjs-app-support";

/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { registerApolloClient } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const registerApolloClient = _registerApolloClient;

/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import type { TransportedQueryRef } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export type TransportedQueryRef<
TData = unknown,
TVariables = unknown,
> = _TransportedQueryRef<TData, TVariables>;
151 changes: 136 additions & 15 deletions packages/experimental-nextjs-app-support/src/ssr/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,138 @@
export {
InMemoryCache as NextSSRInMemoryCache,
ApolloClient as NextSSRApolloClient,
SSRMultipartLink,
DebounceMultipartResponsesLink,
RemoveMultipartDirectivesLink,
ApolloNextAppProvider,
resetApolloClientSingletons as resetNextSSRApolloSingletons,
type TransportedQueryRef,
import {
InMemoryCache,
ApolloClient,
resetApolloClientSingletons,
SSRMultipartLink as _SSRMultipartLink,
DebounceMultipartResponsesLink as _DebounceMultipartResponsesLink,
RemoveMultipartDirectivesLink as _RemoveMultipartDirectivesLink,
ApolloNextAppProvider as _ApolloNextAppProvider,
type TransportedQueryRef as _TransportedQueryRef,
} from "@apollo/experimental-nextjs-app-support";
export {
useBackgroundQuery,
useFragment,
useQuery,
useReadQuery,
useSuspenseQuery,
import {
useBackgroundQuery as _useBackgroundQuery,
useFragment as _useFragment,
useQuery as _useQuery,
useReadQuery as _useReadQuery,
useSuspenseQuery as _useSuspenseQuery,
} from "@apollo/client/index.js";

/**
* @deprecated
* This import has been renamed to `InMemoryCache` and moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { InMemoryCache } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const NextSSRInMemoryCache = InMemoryCache;
/**
* @deprecated
* This import has been renamed to `ApolloClient` and moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { ApolloClient } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const NextSSRApolloClient = ApolloClient;
/**
* @deprecated
* This import has been renamed to `resetApolloClientSingletons` and moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { resetApolloClientSingletons } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const resetNextSSRApolloSingletons = resetApolloClientSingletons;
/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { SSRMultipartLink } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const SSRMultipartLink = _SSRMultipartLink;
/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { DebounceMultipartResponsesLink } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const DebounceMultipartResponsesLink = _DebounceMultipartResponsesLink;
/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { RemoveMultipartDirectivesLink } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const RemoveMultipartDirectivesLink = _RemoveMultipartDirectivesLink;
/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import { ApolloNextAppProvider } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export const ApolloNextAppProvider = _ApolloNextAppProvider;
/**
* @deprecated
* This import has moved to `"@apollo/experimental-nextjs-app-support"`.
* Please update your import to
* ```ts
* import type { TransportedQueryRef } from "@apollo/experimental-nextjs-app-support";
* ```
*/
export type TransportedQueryRef<
TData = unknown,
TVariables = unknown,
> = _TransportedQueryRef<TData, TVariables>;
/**
* @deprecated
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Please update your import to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Importing `useBackgroundQuery` from this package is no longer necessary. Import it directly from `@apollo/client` instead.

[nit] I'd break this up into two sentences as I think it reads a bit better. Feel free to keep what you have though if you don't like this change, especially since this is just what you see in the editor. If you do like this, the other hook deprecations could also need this change to keep this consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

* ```ts
* import { useBackgroundQuery } from "@apollo/client";
* ```
*/
export const useBackgroundQuery = _useBackgroundQuery;
/**
* @deprecated
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Please update your import to
* ```ts
* import { useFragment } from "@apollo/client";
* ```
*/
export const useFragment = _useFragment;
/**
* @deprecated
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Please update your import to
* ```ts
* import { useQuery } from "@apollo/client";
* ```
*/
export const useQuery = _useQuery;
/**
* @deprecated
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Please update your import to
* ```ts
* import { useReadQuery } from "@apollo/client";
* ```
*/
export const useReadQuery = _useReadQuery;
/**
* @deprecated
* Importing this hook from this package is not necessary anymore - you can directly import it from `@apollo/client`.
* Please update your import to
* ```ts
* import { useSuspenseQuery } from "@apollo/client";
* ```
*/
export const useSuspenseQuery = _useSuspenseQuery;
Loading