1 | import type { QueryRef } from "../internal/index.js";
|
2 | import type { OperationVariables } from "../../core/types.js";
|
3 | import type { RefetchFunction, FetchMoreFunction, SubscribeToMoreFunction } from "./useSuspenseQuery.js";
|
4 | export interface UseQueryRefHandlersResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
5 | /**
|
6 | * Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
|
7 | *
|
8 | * @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
|
9 | */
|
10 | refetch: RefetchFunction<TData, TVariables>;
|
11 | /**
|
12 | * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
|
13 | */
|
14 | fetchMore: FetchMoreFunction<TData, TVariables>;
|
15 | /**
|
16 | * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
17 | *
|
18 | * This function returns _another_ function that you can call to terminate the subscription.
|
19 | */
|
20 | subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
21 | }
|
22 | /**
|
23 | * A React hook that returns a `refetch` and `fetchMore` function for a given
|
24 | * `queryRef`.
|
25 | *
|
26 | * This is useful to get access to handlers for a `queryRef` that was created by
|
27 | * `createQueryPreloader` or when the handlers for a `queryRef` produced in
|
28 | * a different component are inaccessible.
|
29 | *
|
30 | * @example
|
31 | * ```tsx
|
32 | * const MyComponent({ queryRef }) {
|
33 | * const { refetch, fetchMore } = useQueryRefHandlers(queryRef);
|
34 | *
|
35 | * // ...
|
36 | * }
|
37 | * ```
|
38 | * @since 3.9.0
|
39 | * @param queryRef - A `QueryRef` returned from `useBackgroundQuery`, `useLoadableQuery`, or `createQueryPreloader`.
|
40 | */
|
41 | export declare function useQueryRefHandlers<TData = unknown, TVariables extends OperationVariables = OperationVariables>(queryRef: QueryRef<TData, TVariables>): UseQueryRefHandlersResult<TData, TVariables>;
|
42 | //# sourceMappingURL=useQueryRefHandlers.d.ts.map |
\ | No newline at end of file |