import type { ApolloClient, OperationVariables } from "@apollo/client"; import React from "react"; import type { PreloadQuery } from "./PreloadQuery.js"; /** * > This export is only available in React Server Components * * Ensures that you can always access the same instance of ApolloClient * during RSC for an ongoing request, while always returning * a new instance for different requests. * * @example * ```ts * export const { getClient, query, PreloadQuery } = registerApolloClient(() => { * return new ApolloClient({ * cache: new InMemoryCache(), * link: new HttpLink({ * uri: "http://example.com/api/graphql", * }), * }); * }); * ``` * * @public */ export declare function registerApolloClient | ApolloClient>(makeClient: () => ApolloClientOrPromise): { getClient: () => ApolloClientOrPromise; query: Awaited["query"]; /** * Preloads data in React Server Components to be hydrated * in Client Components. * * ### Example with `queryRef` * `ClientChild` would call `useReadQuery` with the `queryRef`, the `Suspense` boundary is optional: * ```jsx * * {(queryRef) => ( * loading}> * * * )} * * ``` * * ### Example for `useSuspenseQuery` * `ClientChild` would call the same query with `useSuspenseQuery`, the `Suspense` boundary is optional: * ```jsx * * loading}> * * * * ``` */ PreloadQuery: PreloadQueryComponent; }; /** * @deprecated use `PreloadQuery.Props` instead * @public */ export type PreloadQueryProps = PreloadQuery.Props; /** * Preloads data in React Server Components to be hydrated * in Client Components. * * ### Example with `queryRef` * `ClientChild` would call `useReadQuery` with the `queryRef`, the `Suspense` boundary is optional: * ```jsx * * {(queryRef) => ( * loading}> * * * )} * * ``` * * ### Example for `useSuspenseQuery` * `ClientChild` would call the same query with `useSuspenseQuery`, the `Suspense` boundary is optional: * ```jsx * * loading}> * * * * ``` * * @public */ export interface PreloadQueryComponent { (props: PreloadQuery.Props): React.ReactElement; } //# sourceMappingURL=registerApolloClient.d.ts.map