@tanstack/vue-query 5.14.6 → 5.15.3
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/index.d.cts +1 -1
- package/build/legacy/queryOptions.d.cts +1 -1
- package/build/legacy/useBaseQuery.d.cts +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +1 -1
- package/build/legacy/useQueries.d.cts +1 -1
- package/build/legacy/useQuery.d.cts +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/queryOptions.d.cts +1 -1
- package/build/modern/useBaseQuery.d.cts +1 -1
- package/build/modern/useInfiniteQuery.d.cts +1 -1
- package/build/modern/useQueries.d.cts +1 -1
- package/build/modern/useQuery.d.cts +1 -1
- package/package.json +2 -1
- package/src/__tests__/queryOptions.types.test.ts +61 -66
- package/src/__tests__/useIsMutating.test.ts +1 -1
- /package/build/legacy/{useQuery-bwd-ixSz.d.ts → useQuery-bwd-ixSz.d.cts} +0 -0
- /package/build/modern/{useQuery-bwd-ixSz.d.ts → useQuery-bwd-ixSz.d.cts} +0 -0
package/build/legacy/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export { QueryClient } from './queryClient.cjs';
|
|
|
5
5
|
export { QueryCache } from './queryCache.cjs';
|
|
6
6
|
export { queryOptions } from './queryOptions.cjs';
|
|
7
7
|
export { MutationCache } from './mutationCache.cjs';
|
|
8
|
-
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './useQuery-bwd-ixSz.
|
|
8
|
+
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './useQuery-bwd-ixSz.cjs';
|
|
9
9
|
export { UseQueriesOptions, UseQueriesResults, useQueries } from './useQueries.cjs';
|
|
10
10
|
export { UseMutationOptions, UseMutationReturnType, useMutation } from './useMutation.cjs';
|
|
11
11
|
export { QueryFilters, useIsFetching } from './useIsFetching.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefaultError, QueryKey, DataTag } from '@tanstack/query-core';
|
|
2
|
-
import { f as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './useQuery-bwd-ixSz.
|
|
2
|
+
import { f as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import './types.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'vue-demi';
|
|
2
2
|
import '@tanstack/query-core';
|
|
3
3
|
import './queryClient.cjs';
|
|
4
|
-
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './useQuery-bwd-ixSz.
|
|
4
|
+
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './useQuery-bwd-ixSz.cjs';
|
|
5
5
|
import './types.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@tanstack/query-core';
|
|
2
|
-
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './useQuery-bwd-ixSz.
|
|
2
|
+
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import './types.cjs';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import 'vue-demi';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue-demi';
|
|
2
2
|
import { QueryObserverResult, QueryKey, QueriesPlaceholderDataFunction, QueryFunction, ThrowOnError, DefaultError, DefinedQueryObserverResult } from '@tanstack/query-core';
|
|
3
|
-
import { U as UseQueryOptions } from './useQuery-bwd-ixSz.
|
|
3
|
+
import { U as UseQueryOptions } from './useQuery-bwd-ixSz.cjs';
|
|
4
4
|
import { QueryClient } from './queryClient.cjs';
|
|
5
5
|
import { MaybeRefDeep, DistributiveOmit, DeepUnwrapRef } from './types.cjs';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@tanstack/query-core';
|
|
2
|
-
export { D as DefinedInitialQueryOptions, f as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './useQuery-bwd-ixSz.
|
|
2
|
+
export { D as DefinedInitialQueryOptions, f as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import './types.cjs';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import 'vue-demi';
|
package/build/modern/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ export { QueryClient } from './queryClient.cjs';
|
|
|
5
5
|
export { QueryCache } from './queryCache.cjs';
|
|
6
6
|
export { queryOptions } from './queryOptions.cjs';
|
|
7
7
|
export { MutationCache } from './mutationCache.cjs';
|
|
8
|
-
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './useQuery-bwd-ixSz.
|
|
8
|
+
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './useQuery-bwd-ixSz.cjs';
|
|
9
9
|
export { UseQueriesOptions, UseQueriesResults, useQueries } from './useQueries.cjs';
|
|
10
10
|
export { UseMutationOptions, UseMutationReturnType, useMutation } from './useMutation.cjs';
|
|
11
11
|
export { QueryFilters, useIsFetching } from './useIsFetching.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefaultError, QueryKey, DataTag } from '@tanstack/query-core';
|
|
2
|
-
import { f as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './useQuery-bwd-ixSz.
|
|
2
|
+
import { f as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import './types.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'vue-demi';
|
|
2
2
|
import '@tanstack/query-core';
|
|
3
3
|
import './queryClient.cjs';
|
|
4
|
-
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './useQuery-bwd-ixSz.
|
|
4
|
+
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './useQuery-bwd-ixSz.cjs';
|
|
5
5
|
import './types.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@tanstack/query-core';
|
|
2
|
-
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './useQuery-bwd-ixSz.
|
|
2
|
+
export { d as UseInfiniteQueryOptions, e as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import './types.cjs';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import 'vue-demi';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue-demi';
|
|
2
2
|
import { QueryObserverResult, QueryKey, QueriesPlaceholderDataFunction, QueryFunction, ThrowOnError, DefaultError, DefinedQueryObserverResult } from '@tanstack/query-core';
|
|
3
|
-
import { U as UseQueryOptions } from './useQuery-bwd-ixSz.
|
|
3
|
+
import { U as UseQueryOptions } from './useQuery-bwd-ixSz.cjs';
|
|
4
4
|
import { QueryClient } from './queryClient.cjs';
|
|
5
5
|
import { MaybeRefDeep, DistributiveOmit, DeepUnwrapRef } from './types.cjs';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@tanstack/query-core';
|
|
2
|
-
export { D as DefinedInitialQueryOptions, f as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './useQuery-bwd-ixSz.
|
|
2
|
+
export { D as DefinedInitialQueryOptions, f as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './useQuery-bwd-ixSz.cjs';
|
|
3
3
|
import './types.cjs';
|
|
4
4
|
import './queryClient.cjs';
|
|
5
5
|
import 'vue-demi';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.3",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
|
|
5
5
|
"author": "Damian Osipiuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@tanstack/query-core": "5.14.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
55
56
|
"@vue/composition-api": "1.7.2",
|
|
56
57
|
"vue": "^3.3.0",
|
|
57
58
|
"vue2": "npm:vue@2.6",
|
|
@@ -57,86 +57,81 @@ describe('queryOptions', () => {
|
|
|
57
57
|
> = true
|
|
58
58
|
return result
|
|
59
59
|
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const result: Expect<
|
|
69
|
-
Equal<(typeof queryKey)[typeof dataTagSymbol], number>
|
|
70
|
-
> = true
|
|
71
|
-
return result
|
|
60
|
+
})
|
|
61
|
+
it('should tag the queryKey even if no promise is returned', () => {
|
|
62
|
+
doNotExecute(() => {
|
|
63
|
+
const { queryKey } = queryOptions({
|
|
64
|
+
queryKey: ['key'],
|
|
65
|
+
queryFn: () => 5,
|
|
72
66
|
})
|
|
73
|
-
})
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const result: Expect<
|
|
82
|
-
Equal<(typeof queryKey)[typeof dataTagSymbol], unknown>
|
|
83
|
-
> = true
|
|
84
|
-
return result
|
|
85
|
-
})
|
|
68
|
+
const result: Expect<
|
|
69
|
+
Equal<(typeof queryKey)[typeof dataTagSymbol], number>
|
|
70
|
+
> = true
|
|
71
|
+
return result
|
|
86
72
|
})
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
queryFn: () => Promise.resolve(5),
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
const queryClient = new QueryClient()
|
|
96
|
-
const data = queryClient.getQueryData(queryKey)
|
|
97
|
-
|
|
98
|
-
const result: Expect<Equal<typeof data, number | undefined>> = true
|
|
99
|
-
return result
|
|
73
|
+
})
|
|
74
|
+
it('should tag the queryKey with unknown if there is no queryFn', () => {
|
|
75
|
+
doNotExecute(() => {
|
|
76
|
+
const { queryKey } = queryOptions({
|
|
77
|
+
queryKey: ['key'],
|
|
100
78
|
})
|
|
79
|
+
|
|
80
|
+
const result: Expect<
|
|
81
|
+
Equal<(typeof queryKey)[typeof dataTagSymbol], unknown>
|
|
82
|
+
> = true
|
|
83
|
+
return result
|
|
101
84
|
})
|
|
85
|
+
})
|
|
86
|
+
it('should return the proper type when passed to getQueryData', () => {
|
|
87
|
+
doNotExecute(() => {
|
|
88
|
+
const { queryKey } = queryOptions({
|
|
89
|
+
queryKey: ['key'],
|
|
90
|
+
queryFn: () => Promise.resolve(5),
|
|
91
|
+
})
|
|
102
92
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const { queryKey } = queryOptions({
|
|
106
|
-
queryKey: ['key'],
|
|
107
|
-
queryFn: () => Promise.resolve(5),
|
|
108
|
-
})
|
|
93
|
+
const queryClient = new QueryClient()
|
|
94
|
+
const data = queryClient.getQueryData(queryKey)
|
|
109
95
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
const result: Expect<Equal<typeof data, number | undefined>> = true
|
|
97
|
+
return result
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
it('should properly type updaterFn when passed to setQueryData', () => {
|
|
101
|
+
doNotExecute(() => {
|
|
102
|
+
const { queryKey } = queryOptions({
|
|
103
|
+
queryKey: ['key'],
|
|
104
|
+
queryFn: () => Promise.resolve(5),
|
|
105
|
+
})
|
|
115
106
|
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
const queryClient = new QueryClient()
|
|
108
|
+
const data = queryClient.setQueryData(queryKey, (prev) => {
|
|
109
|
+
const result: Expect<Equal<typeof prev, number | undefined>> = true
|
|
110
|
+
return result ? prev : 1
|
|
118
111
|
})
|
|
119
|
-
})
|
|
120
112
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
const result: Expect<Equal<typeof data, number | undefined>> = true
|
|
114
|
+
return result
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
it('should properly type value when passed to setQueryData', () => {
|
|
118
|
+
doNotExecute(() => {
|
|
119
|
+
const { queryKey } = queryOptions({
|
|
120
|
+
queryKey: ['key'],
|
|
121
|
+
queryFn: () => Promise.resolve(5),
|
|
122
|
+
})
|
|
127
123
|
|
|
128
|
-
|
|
124
|
+
const queryClient = new QueryClient()
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
// @ts-expect-error value should be a number
|
|
127
|
+
queryClient.setQueryData(queryKey, '5')
|
|
128
|
+
// @ts-expect-error value should be a number
|
|
129
|
+
queryClient.setQueryData(queryKey, () => '5')
|
|
134
130
|
|
|
135
|
-
|
|
131
|
+
const data = queryClient.setQueryData(queryKey, 5)
|
|
136
132
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
133
|
+
const result: Expect<Equal<typeof data, number | undefined>> = true
|
|
134
|
+
return result
|
|
140
135
|
})
|
|
141
136
|
})
|
|
142
137
|
})
|
|
File without changes
|
|
File without changes
|