@tanstack/react-query 5.0.0-rc.5 → 5.0.0-rc.6
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/infiniteQueryOptions.cjs.map +1 -1
- package/build/legacy/infiniteQueryOptions.d.cts +11 -6
- package/build/legacy/infiniteQueryOptions.d.ts +11 -6
- package/build/legacy/infiniteQueryOptions.js.map +1 -1
- package/build/legacy/queryOptions.cjs.map +1 -1
- package/build/legacy/queryOptions.d.cts +6 -5
- package/build/legacy/queryOptions.d.ts +6 -5
- package/build/legacy/queryOptions.js.map +1 -1
- package/build/legacy/useInfiniteQuery.cjs.map +1 -1
- package/build/legacy/useInfiniteQuery.d.cts +2 -2
- package/build/legacy/useInfiniteQuery.d.ts +2 -2
- package/build/legacy/useInfiniteQuery.js.map +1 -1
- package/build/legacy/useQueries.cjs.map +1 -1
- package/build/legacy/useQueries.js.map +1 -1
- package/build/modern/infiniteQueryOptions.cjs.map +1 -1
- package/build/modern/infiniteQueryOptions.d.cts +11 -6
- package/build/modern/infiniteQueryOptions.d.ts +11 -6
- package/build/modern/infiniteQueryOptions.js.map +1 -1
- package/build/modern/queryOptions.cjs.map +1 -1
- package/build/modern/queryOptions.d.cts +6 -5
- package/build/modern/queryOptions.d.ts +6 -5
- package/build/modern/queryOptions.js.map +1 -1
- package/build/modern/useInfiniteQuery.cjs.map +1 -1
- package/build/modern/useInfiniteQuery.d.cts +2 -2
- package/build/modern/useInfiniteQuery.d.ts +2 -2
- package/build/modern/useInfiniteQuery.js.map +1 -1
- package/build/modern/useQueries.cjs.map +1 -1
- package/build/modern/useQueries.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/infiniteQueryOptions.types.test.tsx +163 -0
- package/src/__tests__/queryOptions.types.test.tsx +154 -3
- package/src/__tests__/useQuery.test.tsx +2 -2
- package/src/__tests__/useQuery.types.test.tsx +12 -8
- package/src/infiniteQueryOptions.ts +21 -22
- package/src/queryOptions.ts +11 -19
- package/src/useInfiniteQuery.ts +0 -2
- package/src/useQueries.ts +1 -1
package/src/queryOptions.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultError, QueryKey } from '@tanstack/query-core'
|
|
1
|
+
import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
|
|
2
2
|
import type { UseQueryOptions } from './types'
|
|
3
3
|
|
|
4
4
|
export type UndefinedInitialDataOptions<
|
|
@@ -23,35 +23,27 @@ export type DefinedInitialDataOptions<
|
|
|
23
23
|
| (() => NonUndefinedGuard<TQueryFnData>)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
type ValidateQueryOptions<T> = {
|
|
27
|
-
[K in keyof T]: K extends keyof UseQueryOptions ? T[K] : never
|
|
28
|
-
}
|
|
29
|
-
|
|
30
26
|
export function queryOptions<
|
|
31
27
|
TQueryFnData = unknown,
|
|
32
28
|
TError = DefaultError,
|
|
33
29
|
TData = TQueryFnData,
|
|
34
30
|
TQueryKey extends QueryKey = QueryKey,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
> = UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
41
|
-
>(options: ValidateQueryOptions<TOptions>): TOptions
|
|
31
|
+
>(
|
|
32
|
+
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
33
|
+
): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
34
|
+
queryKey: DataTag<TQueryKey, TData>
|
|
35
|
+
}
|
|
42
36
|
|
|
43
37
|
export function queryOptions<
|
|
44
38
|
TQueryFnData = unknown,
|
|
45
39
|
TError = DefaultError,
|
|
46
40
|
TData = TQueryFnData,
|
|
47
41
|
TQueryKey extends QueryKey = QueryKey,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
> = DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
54
|
-
>(options: ValidateQueryOptions<TOptions>): TOptions
|
|
42
|
+
>(
|
|
43
|
+
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
44
|
+
): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
45
|
+
queryKey: DataTag<TQueryKey, TData>
|
|
46
|
+
}
|
|
55
47
|
|
|
56
48
|
export function queryOptions(options: unknown) {
|
|
57
49
|
return options
|
package/src/useInfiniteQuery.ts
CHANGED
|
@@ -29,7 +29,6 @@ export function useInfiniteQuery<
|
|
|
29
29
|
TQueryFnData,
|
|
30
30
|
TError,
|
|
31
31
|
TData,
|
|
32
|
-
TQueryFnData,
|
|
33
32
|
TQueryKey,
|
|
34
33
|
TPageParam
|
|
35
34
|
>,
|
|
@@ -47,7 +46,6 @@ export function useInfiniteQuery<
|
|
|
47
46
|
TQueryFnData,
|
|
48
47
|
TError,
|
|
49
48
|
TData,
|
|
50
|
-
TQueryFnData,
|
|
51
49
|
TQueryKey,
|
|
52
50
|
TPageParam
|
|
53
51
|
>,
|
package/src/useQueries.ts
CHANGED
|
@@ -27,7 +27,7 @@ import type {
|
|
|
27
27
|
} from '@tanstack/query-core'
|
|
28
28
|
|
|
29
29
|
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.
|
|
30
|
-
// `placeholderData` function
|
|
30
|
+
// `placeholderData` function always gets undefined passed
|
|
31
31
|
type UseQueryOptionsForUseQueries<
|
|
32
32
|
TQueryFnData = unknown,
|
|
33
33
|
TError = DefaultError,
|