Open History to see the last commit
1import { QueryClient as QueryCoreClient } from '@tanstack/query-core'
2import type {
3 DefaultOptions as CoreDefaultOptions,
4 DefaultError,
5 QueryClientConfig as QueryCoreClientConfig,
6 InfiniteQueryObserverOptions as QueryCoreInfiniteQueryObserverOptions,
7 QueryObserverOptions as QueryCoreObserverOptions,
8 QueryKey,
9} from '@tanstack/query-core'
10β
11export interface QueryObserverOptions<
12 TQueryFnData = unknown,
13 TError = DefaultError,
14 TData = TQueryFnData,
15 TQueryData = TQueryFnData,
16 TQueryKey extends QueryKey = QueryKey,
17 TPageParam = never,
18> extends Omit<
19 QueryCoreObserverOptions<
20 TQueryFnData,
21 TError,
22 TData,
23 TQueryData,
24 TQueryKey,
25 TPageParam
26 >,
27 'structuralSharing'
28 > {
29 /**
30 * Set this to a reconciliation key to enable reconciliation between query results.
31 * Set this to `false` to disable reconciliation between query results.
32 * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
33 * Defaults reconciliation to false.
34 */
35 reconcile?:
36 | string
37 | false
38 | ((oldData: TData | undefined, newData: TData) => TData)
39}
40β
41export interface InfiniteQueryObserverOptions<
42 TQueryFnData = unknown,
43 TError = DefaultError,
44 TData = TQueryFnData,
45 TQueryData = TQueryFnData,
46 TQueryKey extends QueryKey = QueryKey,
47 TPageParam = unknown,
48> extends Omit<
49 QueryCoreInfiniteQueryObserverOptions<
50 TQueryFnData,
51 TError,
52 TData,
53 TQueryData,
54 TQueryKey,
55 TPageParam
56 >,
57 'structuralSharing'
58 > {
59 /**
60 * Set this to a reconciliation key to enable reconciliation between query results.
61 * Set this to `false` to disable reconciliation between query results.
62 * Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic.
63 * Defaults reconciliation to false.
64 */
65 reconcile?:
66 | string
67 | false
68 | ((oldData: TData | undefined, newData: TData) => TData)
69}
70β
71export interface DefaultOptions<TError = DefaultError>
72 extends CoreDefaultOptions<TError> {
73 queries?: QueryObserverOptions<unknown, TError>
74}
75β
76export interface QueryClientConfig extends QueryCoreClientConfig {
77 defaultOptions?: DefaultOptions
78}
79β
80export class QueryClient extends QueryCoreClient {
81 constructor(config: QueryClientConfig = {}) {
82 super(config)
83 }
84}