@tanstack/query-core 5.61.5 → 5.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/{hydration-BjZRNbiy.d.cts → hydration-BOBMySlm.d.cts} +13 -9
- package/build/legacy/{hydration-BVZaQiae.d.ts → hydration-OMuWWX9N.d.ts} +13 -9
- package/build/legacy/hydration.d.cts +1 -1
- package/build/legacy/hydration.d.ts +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +1 -1
- package/build/legacy/mutation.d.cts +1 -1
- package/build/legacy/mutation.d.ts +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationObserver.d.cts +1 -1
- package/build/legacy/mutationObserver.d.ts +1 -1
- package/build/legacy/queriesObserver.d.cts +1 -1
- package/build/legacy/queriesObserver.d.ts +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryClient.cjs +3 -1
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryClient.js +3 -1
- package/build/legacy/queryClient.js.map +1 -1
- package/build/legacy/queryObserver.d.cts +1 -1
- package/build/legacy/queryObserver.d.ts +1 -1
- package/build/legacy/retryer.d.cts +1 -1
- package/build/legacy/retryer.d.ts +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/legacy/utils.js.map +1 -1
- package/build/modern/{hydration-BjZRNbiy.d.cts → hydration-BOBMySlm.d.cts} +13 -9
- package/build/modern/{hydration-BVZaQiae.d.ts → hydration-OMuWWX9N.d.ts} +13 -9
- package/build/modern/hydration.d.cts +1 -1
- package/build/modern/hydration.d.ts +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +1 -1
- package/build/modern/mutation.d.cts +1 -1
- package/build/modern/mutation.d.ts +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationObserver.d.cts +1 -1
- package/build/modern/mutationObserver.d.ts +1 -1
- package/build/modern/queriesObserver.d.cts +1 -1
- package/build/modern/queriesObserver.d.ts +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryClient.cjs +3 -1
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryClient.js +3 -1
- package/build/modern/queryClient.js.map +1 -1
- package/build/modern/queryObserver.d.cts +1 -1
- package/build/modern/queryObserver.d.ts +1 -1
- package/build/modern/retryer.d.cts +1 -1
- package/build/modern/retryer.d.ts +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/build/modern/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/queryClient.ts +20 -6
- package/src/types.ts +7 -3
- package/src/utils.ts +2 -2
package/src/queryClient.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
RefetchQueryFilters,
|
|
40
40
|
ResetOptions,
|
|
41
41
|
SetDataOptions,
|
|
42
|
+
UnsetMarker,
|
|
42
43
|
} from './types'
|
|
43
44
|
import type { QueryState } from './query'
|
|
44
45
|
import type { MutationFilters, QueryFilters, Updater } from './utils'
|
|
@@ -119,7 +120,8 @@ export class QueryClient {
|
|
|
119
120
|
TTaggedQueryKey extends QueryKey = QueryKey,
|
|
120
121
|
TInferredQueryFnData = TTaggedQueryKey extends DataTag<
|
|
121
122
|
unknown,
|
|
122
|
-
infer TaggedValue
|
|
123
|
+
infer TaggedValue,
|
|
124
|
+
unknown
|
|
123
125
|
>
|
|
124
126
|
? TaggedValue
|
|
125
127
|
: TQueryFnData,
|
|
@@ -169,7 +171,8 @@ export class QueryClient {
|
|
|
169
171
|
TTaggedQueryKey extends QueryKey = QueryKey,
|
|
170
172
|
TInferredQueryFnData = TTaggedQueryKey extends DataTag<
|
|
171
173
|
unknown,
|
|
172
|
-
infer TaggedValue
|
|
174
|
+
infer TaggedValue,
|
|
175
|
+
unknown
|
|
173
176
|
>
|
|
174
177
|
? TaggedValue
|
|
175
178
|
: TQueryFnData,
|
|
@@ -225,16 +228,27 @@ export class QueryClient {
|
|
|
225
228
|
TTaggedQueryKey extends QueryKey = QueryKey,
|
|
226
229
|
TInferredQueryFnData = TTaggedQueryKey extends DataTag<
|
|
227
230
|
unknown,
|
|
228
|
-
infer TaggedValue
|
|
231
|
+
infer TaggedValue,
|
|
232
|
+
unknown
|
|
229
233
|
>
|
|
230
234
|
? TaggedValue
|
|
231
235
|
: TQueryFnData,
|
|
236
|
+
TInferredError = TTaggedQueryKey extends DataTag<
|
|
237
|
+
unknown,
|
|
238
|
+
unknown,
|
|
239
|
+
infer TaggedError
|
|
240
|
+
>
|
|
241
|
+
? TaggedError extends UnsetMarker
|
|
242
|
+
? TError
|
|
243
|
+
: TaggedError
|
|
244
|
+
: TError,
|
|
232
245
|
>(
|
|
233
246
|
queryKey: TTaggedQueryKey,
|
|
234
|
-
): QueryState<TInferredQueryFnData,
|
|
247
|
+
): QueryState<TInferredQueryFnData, TInferredError> | undefined {
|
|
235
248
|
const options = this.defaultQueryOptions({ queryKey })
|
|
236
|
-
return this.#queryCache.get<TInferredQueryFnData,
|
|
237
|
-
|
|
249
|
+
return this.#queryCache.get<TInferredQueryFnData, TInferredError>(
|
|
250
|
+
options.queryHash,
|
|
251
|
+
)?.state
|
|
238
252
|
}
|
|
239
253
|
|
|
240
254
|
removeQueries(filters?: QueryFilters): void {
|
package/src/types.ts
CHANGED
|
@@ -43,8 +43,12 @@ export type DefaultError = Register extends {
|
|
|
43
43
|
export type QueryKey = ReadonlyArray<unknown>
|
|
44
44
|
|
|
45
45
|
export declare const dataTagSymbol: unique symbol
|
|
46
|
-
export
|
|
46
|
+
export declare const dataTagErrorSymbol: unique symbol
|
|
47
|
+
export declare const unsetMarker: unique symbol
|
|
48
|
+
export type UnsetMarker = typeof unsetMarker
|
|
49
|
+
export type DataTag<TType, TValue, TError = UnsetMarker> = TType & {
|
|
47
50
|
[dataTagSymbol]: TValue
|
|
51
|
+
[dataTagErrorSymbol]: TError
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export type QueryFunction<
|
|
@@ -536,7 +540,7 @@ export interface RefetchOptions extends ResultOptions {
|
|
|
536
540
|
|
|
537
541
|
export interface InvalidateQueryFilters<
|
|
538
542
|
TQueryFnData = unknown,
|
|
539
|
-
TError =
|
|
543
|
+
TError = DefaultError,
|
|
540
544
|
TData = TQueryFnData,
|
|
541
545
|
TQueryKey extends QueryKey = QueryKey,
|
|
542
546
|
> extends QueryFilters<TQueryFnData, TError, TData, TQueryKey> {
|
|
@@ -545,7 +549,7 @@ export interface InvalidateQueryFilters<
|
|
|
545
549
|
|
|
546
550
|
export interface RefetchQueryFilters<
|
|
547
551
|
TQueryFnData = unknown,
|
|
548
|
-
TError =
|
|
552
|
+
TError = DefaultError,
|
|
549
553
|
TData = TQueryFnData,
|
|
550
554
|
TQueryKey extends QueryKey = QueryKey,
|
|
551
555
|
> extends QueryFilters<TQueryFnData, TError, TData, TQueryKey> {}
|
package/src/utils.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { FetchOptions, Query } from './query'
|
|
|
17
17
|
|
|
18
18
|
export interface QueryFilters<
|
|
19
19
|
TQueryFnData = unknown,
|
|
20
|
-
TError =
|
|
20
|
+
TError = DefaultError,
|
|
21
21
|
TData = TQueryFnData,
|
|
22
22
|
TQueryKey extends QueryKey = QueryKey,
|
|
23
23
|
> {
|
|
@@ -38,7 +38,7 @@ export interface QueryFilters<
|
|
|
38
38
|
*/
|
|
39
39
|
queryKey?: unknown extends TQueryFnData
|
|
40
40
|
? QueryKey
|
|
41
|
-
: QueryKey & DataTag<unknown, TQueryFnData>
|
|
41
|
+
: QueryKey & DataTag<unknown, TQueryFnData, TError>
|
|
42
42
|
/**
|
|
43
43
|
* Include or exclude stale queries
|
|
44
44
|
*/
|