Open History to see the last commit
1import { QueryClient as QueryCoreClient } from '@tanstack/query-core'
2import type {
3 DefaultOptions as CoreDefaultOptions,
4 DefaultError,
5 OmitKeyof,
6 QueryClientConfig as QueryCoreClientConfig,
7 InfiniteQueryObserverOptions as QueryCoreInfiniteQueryObserverOptions,
8 QueryObserverOptions as QueryCoreObserverOptions,
9 QueryKey,
10} from '@tanstack/query-core'
11β
12/**
13 * Core observer options pass through unchanged. The old adapter omitted
14 * `structuralSharing` and replaced it with a store-level `reconcile`
15 * option; with reads derived directly from cache state, core's
16 * cache-level structural sharing is exactly what keeps the data memo
17 * referentially stable, so it is exposed again and `reconcile` is gone.
18 */
19export type QueryObserverOptions<
20 TQueryFnData = unknown,
21 TError = DefaultError,
22 TData = TQueryFnData,
23 TQueryData = TQueryFnData,
24 TQueryKey extends QueryKey = QueryKey,
25 TPageParam = never,
26> = QueryCoreObserverOptions<
27 TQueryFnData,
28 TError,
29 TData,
30 TQueryData,
31 TQueryKey,
32 TPageParam
33>
34β
35export type InfiniteQueryObserverOptions<
36 TQueryFnData = unknown,
37 TError = DefaultError,
38 TData = TQueryFnData,
39 TQueryKey extends QueryKey = QueryKey,
40 TPageParam = unknown,
41> = QueryCoreInfiniteQueryObserverOptions<
42 TQueryFnData,
43 TError,
44 TData,
45 TQueryKey,
46 TPageParam
47>
48β
49export interface DefaultOptions<
50 TError = DefaultError,
51> extends CoreDefaultOptions<TError> {
52 queries?: OmitKeyof<QueryObserverOptions<unknown, TError>, 'queryKey'>
53}
54β
55export interface QueryClientConfig extends QueryCoreClientConfig {
56 defaultOptions?: DefaultOptions
57}
58β
59export class QueryClient extends QueryCoreClient {
60 constructor(config: QueryClientConfig = {}) {
61 super(config)
62 }
63}