@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.
@@ -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.js';
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.js';
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.js';
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.js';
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.js';
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.js';
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';
@@ -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.js';
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.js';
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.js';
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.js';
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.js';
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.js';
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.14.6",
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
- it('should tag the queryKey even if no promise is returned', () => {
62
- doNotExecute(() => {
63
- const { queryKey } = queryOptions({
64
- queryKey: ['key'],
65
- queryFn: () => 5,
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
- it('should tag the queryKey with unknown if there is no queryFn', () => {
76
- doNotExecute(() => {
77
- const { queryKey } = queryOptions({
78
- queryKey: ['key'],
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
- it('should return the proper type when passed to getQueryData', () => {
89
- doNotExecute(() => {
90
- const { queryKey } = queryOptions({
91
- queryKey: ['key'],
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
- it('should properly type updaterFn when passed to setQueryData', () => {
104
- doNotExecute(() => {
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
- const queryClient = new QueryClient()
111
- const data = queryClient.setQueryData(queryKey, (prev) => {
112
- const result: Expect<Equal<typeof prev, number | undefined>> = true
113
- return result ? prev : 1
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
- const result: Expect<Equal<typeof data, number | undefined>> = true
117
- return result
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
- it('should properly type value when passed to setQueryData', () => {
122
- doNotExecute(() => {
123
- const { queryKey } = queryOptions({
124
- queryKey: ['key'],
125
- queryFn: () => Promise.resolve(5),
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
- const queryClient = new QueryClient()
124
+ const queryClient = new QueryClient()
129
125
 
130
- // @ts-expect-error value should be a number
131
- queryClient.setQueryData(queryKey, '5')
132
- // @ts-expect-error value should be a number
133
- queryClient.setQueryData(queryKey, () => '5')
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
- const data = queryClient.setQueryData(queryKey, 5)
131
+ const data = queryClient.setQueryData(queryKey, 5)
136
132
 
137
- const result: Expect<Equal<typeof data, number | undefined>> = true
138
- return result
139
- })
133
+ const result: Expect<Equal<typeof data, number | undefined>> = true
134
+ return result
140
135
  })
141
136
  })
142
137
  })
@@ -117,6 +117,6 @@ describe('useMutationState', () => {
117
117
 
118
118
  const mutationState = useMutationState()
119
119
 
120
- expect(mutationState.value[0]).toContain({ variables: variables })
120
+ expect(mutationState.value[0]?.variables).toEqual(variables)
121
121
  })
122
122
  })