@tanstack/react-query 5.0.0-alpha.1 → 5.0.0-alpha.2
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/lib/types.d.ts +14 -14
- package/build/lib/useInfiniteQuery.d.ts +2 -2
- package/build/lib/useInfiniteQuery.esm.js.map +1 -1
- package/build/lib/useInfiniteQuery.js.map +1 -1
- package/build/lib/useInfiniteQuery.mjs.map +1 -1
- package/build/lib/useMutation.d.ts +2 -2
- package/build/lib/useMutation.esm.js.map +1 -1
- package/build/lib/useMutation.js.map +1 -1
- package/build/lib/useMutation.mjs.map +1 -1
- package/build/lib/useMutationState.d.ts +2 -2
- package/build/lib/useMutationState.esm.js.map +1 -1
- package/build/lib/useMutationState.js.map +1 -1
- package/build/lib/useMutationState.mjs.map +1 -1
- package/build/lib/useQueries.d.ts +3 -3
- package/build/lib/useQueries.esm.js.map +1 -1
- package/build/lib/useQueries.js.map +1 -1
- package/build/lib/useQueries.mjs.map +1 -1
- package/build/lib/useQuery.d.ts +5 -5
- package/build/lib/useQuery.esm.js.map +1 -1
- package/build/lib/useQuery.js.map +1 -1
- package/build/lib/useQuery.mjs.map +1 -1
- package/build/umd/index.development.js +10 -5
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/types.ts +14 -14
- package/src/useInfiniteQuery.ts +2 -2
- package/src/useMutation.ts +2 -2
- package/src/useMutationState.ts +3 -3
- package/src/useQueries.ts +3 -3
- package/src/useQuery.ts +6 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-error-boundary": "^3.1.4"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tanstack/query-core": "5.0.0-alpha.
|
|
38
|
+
"@tanstack/query-core": "5.0.0-alpha.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^18.0.0",
|
package/src/types.ts
CHANGED
|
@@ -11,12 +11,12 @@ import type {
|
|
|
11
11
|
MutateFunction,
|
|
12
12
|
DefinedQueryObserverResult,
|
|
13
13
|
WithRequired,
|
|
14
|
-
|
|
14
|
+
DefaultError,
|
|
15
15
|
} from '@tanstack/query-core'
|
|
16
16
|
|
|
17
17
|
export interface UseBaseQueryOptions<
|
|
18
18
|
TQueryFnData = unknown,
|
|
19
|
-
TError =
|
|
19
|
+
TError = DefaultError,
|
|
20
20
|
TData = TQueryFnData,
|
|
21
21
|
TQueryData = TQueryFnData,
|
|
22
22
|
TQueryKey extends QueryKey = QueryKey,
|
|
@@ -27,7 +27,7 @@ export interface UseBaseQueryOptions<
|
|
|
27
27
|
|
|
28
28
|
export interface UseQueryOptions<
|
|
29
29
|
TQueryFnData = unknown,
|
|
30
|
-
TError =
|
|
30
|
+
TError = DefaultError,
|
|
31
31
|
TData = TQueryFnData,
|
|
32
32
|
TQueryKey extends QueryKey = QueryKey,
|
|
33
33
|
> extends WithRequired<
|
|
@@ -37,7 +37,7 @@ export interface UseQueryOptions<
|
|
|
37
37
|
|
|
38
38
|
export interface UseInfiniteQueryOptions<
|
|
39
39
|
TQueryFnData = unknown,
|
|
40
|
-
TError =
|
|
40
|
+
TError = DefaultError,
|
|
41
41
|
TData = TQueryFnData,
|
|
42
42
|
TQueryData = TQueryFnData,
|
|
43
43
|
TQueryKey extends QueryKey = QueryKey,
|
|
@@ -56,32 +56,32 @@ export interface UseInfiniteQueryOptions<
|
|
|
56
56
|
|
|
57
57
|
export type UseBaseQueryResult<
|
|
58
58
|
TData = unknown,
|
|
59
|
-
TError =
|
|
59
|
+
TError = DefaultError,
|
|
60
60
|
> = QueryObserverResult<TData, TError>
|
|
61
61
|
|
|
62
62
|
export type UseQueryResult<
|
|
63
63
|
TData = unknown,
|
|
64
|
-
TError =
|
|
64
|
+
TError = DefaultError,
|
|
65
65
|
> = UseBaseQueryResult<TData, TError>
|
|
66
66
|
|
|
67
67
|
export type DefinedUseBaseQueryResult<
|
|
68
68
|
TData = unknown,
|
|
69
|
-
TError =
|
|
69
|
+
TError = DefaultError,
|
|
70
70
|
> = DefinedQueryObserverResult<TData, TError>
|
|
71
71
|
|
|
72
72
|
export type DefinedUseQueryResult<
|
|
73
73
|
TData = unknown,
|
|
74
|
-
TError =
|
|
74
|
+
TError = DefaultError,
|
|
75
75
|
> = DefinedUseBaseQueryResult<TData, TError>
|
|
76
76
|
|
|
77
77
|
export type UseInfiniteQueryResult<
|
|
78
78
|
TData = unknown,
|
|
79
|
-
TError =
|
|
79
|
+
TError = DefaultError,
|
|
80
80
|
> = InfiniteQueryObserverResult<TData, TError>
|
|
81
81
|
|
|
82
82
|
export interface UseMutationOptions<
|
|
83
83
|
TData = unknown,
|
|
84
|
-
TError =
|
|
84
|
+
TError = DefaultError,
|
|
85
85
|
TVariables = void,
|
|
86
86
|
TContext = unknown,
|
|
87
87
|
> extends Omit<
|
|
@@ -91,7 +91,7 @@ export interface UseMutationOptions<
|
|
|
91
91
|
|
|
92
92
|
export type UseMutateFunction<
|
|
93
93
|
TData = unknown,
|
|
94
|
-
TError =
|
|
94
|
+
TError = DefaultError,
|
|
95
95
|
TVariables = void,
|
|
96
96
|
TContext = unknown,
|
|
97
97
|
> = (
|
|
@@ -100,14 +100,14 @@ export type UseMutateFunction<
|
|
|
100
100
|
|
|
101
101
|
export type UseMutateAsyncFunction<
|
|
102
102
|
TData = unknown,
|
|
103
|
-
TError =
|
|
103
|
+
TError = DefaultError,
|
|
104
104
|
TVariables = void,
|
|
105
105
|
TContext = unknown,
|
|
106
106
|
> = MutateFunction<TData, TError, TVariables, TContext>
|
|
107
107
|
|
|
108
108
|
export type UseBaseMutationResult<
|
|
109
109
|
TData = unknown,
|
|
110
|
-
TError =
|
|
110
|
+
TError = DefaultError,
|
|
111
111
|
TVariables = unknown,
|
|
112
112
|
TContext = unknown,
|
|
113
113
|
> = Override<
|
|
@@ -117,7 +117,7 @@ export type UseBaseMutationResult<
|
|
|
117
117
|
|
|
118
118
|
export type UseMutationResult<
|
|
119
119
|
TData = unknown,
|
|
120
|
-
TError =
|
|
120
|
+
TError = DefaultError,
|
|
121
121
|
TVariables = unknown,
|
|
122
122
|
TContext = unknown,
|
|
123
123
|
> = UseBaseMutationResult<TData, TError, TVariables, TContext>
|
package/src/useInfiniteQuery.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
QueryObserver,
|
|
3
3
|
QueryKey,
|
|
4
4
|
QueryClient,
|
|
5
|
-
|
|
5
|
+
DefaultError,
|
|
6
6
|
InfiniteData,
|
|
7
7
|
} from '@tanstack/query-core'
|
|
8
8
|
import { InfiniteQueryObserver } from '@tanstack/query-core'
|
|
@@ -12,7 +12,7 @@ import { useBaseQuery } from './useBaseQuery'
|
|
|
12
12
|
// HOOK
|
|
13
13
|
export function useInfiniteQuery<
|
|
14
14
|
TQueryFnData,
|
|
15
|
-
TError =
|
|
15
|
+
TError = DefaultError,
|
|
16
16
|
TData = InfiniteData<TQueryFnData>,
|
|
17
17
|
TQueryKey extends QueryKey = QueryKey,
|
|
18
18
|
TPageParam = unknown,
|
package/src/useMutation.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import type { QueryClient,
|
|
2
|
+
import type { QueryClient, DefaultError } from '@tanstack/query-core'
|
|
3
3
|
import { notifyManager, MutationObserver } from '@tanstack/query-core'
|
|
4
4
|
import { useQueryClient } from './QueryClientProvider'
|
|
5
5
|
import type {
|
|
@@ -13,7 +13,7 @@ import { shouldThrowError } from './utils'
|
|
|
13
13
|
|
|
14
14
|
export function useMutation<
|
|
15
15
|
TData = unknown,
|
|
16
|
-
TError =
|
|
16
|
+
TError = DefaultError,
|
|
17
17
|
TVariables = void,
|
|
18
18
|
TContext = unknown,
|
|
19
19
|
>(
|
package/src/useMutationState.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
QueryClient,
|
|
6
6
|
Mutation,
|
|
7
7
|
MutationCache,
|
|
8
|
-
|
|
8
|
+
DefaultError,
|
|
9
9
|
} from '@tanstack/query-core'
|
|
10
10
|
import { notifyManager, replaceEqualDeep } from '@tanstack/query-core'
|
|
11
11
|
import { useQueryClient } from './QueryClientProvider'
|
|
@@ -25,7 +25,7 @@ export function useIsMutating(
|
|
|
25
25
|
type MutationStateOptions<TResult> = {
|
|
26
26
|
filters?: MutationFilters
|
|
27
27
|
select?: (
|
|
28
|
-
mutation: Mutation<unknown,
|
|
28
|
+
mutation: Mutation<unknown, DefaultError, unknown, unknown>,
|
|
29
29
|
) => TResult
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ function getResult<TResult = MutationState>(
|
|
|
39
39
|
(mutation): TResult =>
|
|
40
40
|
(options.select
|
|
41
41
|
? options.select(
|
|
42
|
-
mutation as Mutation<unknown,
|
|
42
|
+
mutation as Mutation<unknown, DefaultError, unknown, unknown>,
|
|
43
43
|
)
|
|
44
44
|
: mutation.state) as TResult,
|
|
45
45
|
)
|
package/src/useQueries.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
QueryFunction,
|
|
6
6
|
QueriesPlaceholderDataFunction,
|
|
7
7
|
QueryClient,
|
|
8
|
-
|
|
8
|
+
DefaultError,
|
|
9
9
|
} from '@tanstack/query-core'
|
|
10
10
|
import { notifyManager, QueriesObserver } from '@tanstack/query-core'
|
|
11
11
|
import { useQueryClient } from './QueryClientProvider'
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
// `placeholderData` function does not have a parameter
|
|
29
29
|
type UseQueryOptionsForUseQueries<
|
|
30
30
|
TQueryFnData = unknown,
|
|
31
|
-
TError =
|
|
31
|
+
TError = DefaultError,
|
|
32
32
|
TData = TQueryFnData,
|
|
33
33
|
TQueryKey extends QueryKey = QueryKey,
|
|
34
34
|
> = Omit<
|
|
@@ -150,7 +150,7 @@ export type QueriesResults<
|
|
|
150
150
|
? // Dynamic-size (homogenous) UseQueryOptions array: map directly to array of results
|
|
151
151
|
UseQueryResult<
|
|
152
152
|
unknown extends TData ? TQueryFnData : TData,
|
|
153
|
-
unknown extends TError ?
|
|
153
|
+
unknown extends TError ? DefaultError : TError
|
|
154
154
|
>[]
|
|
155
155
|
: // Fallback
|
|
156
156
|
UseQueryResult[]
|
package/src/useQuery.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
QueryClient,
|
|
3
|
-
QueryKey,
|
|
4
|
-
RegisteredError,
|
|
5
|
-
} from '@tanstack/query-core'
|
|
1
|
+
import type { QueryClient, QueryKey, DefaultError } from '@tanstack/query-core'
|
|
6
2
|
import { QueryObserver } from '@tanstack/query-core'
|
|
7
3
|
import type {
|
|
8
4
|
DefinedUseQueryResult,
|
|
@@ -14,7 +10,7 @@ import { useBaseQuery } from './useBaseQuery'
|
|
|
14
10
|
// HOOK
|
|
15
11
|
type UndefinedInitialDataOptions<
|
|
16
12
|
TQueryFnData = unknown,
|
|
17
|
-
TError =
|
|
13
|
+
TError = DefaultError,
|
|
18
14
|
TData = TQueryFnData,
|
|
19
15
|
TQueryKey extends QueryKey = QueryKey,
|
|
20
16
|
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
@@ -23,7 +19,7 @@ type UndefinedInitialDataOptions<
|
|
|
23
19
|
|
|
24
20
|
type DefinedInitialDataOptions<
|
|
25
21
|
TQueryFnData = unknown,
|
|
26
|
-
TError =
|
|
22
|
+
TError = DefaultError,
|
|
27
23
|
TData = TQueryFnData,
|
|
28
24
|
TQueryKey extends QueryKey = QueryKey,
|
|
29
25
|
> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
|
@@ -32,7 +28,7 @@ type DefinedInitialDataOptions<
|
|
|
32
28
|
|
|
33
29
|
export function useQuery<
|
|
34
30
|
TQueryFnData = unknown,
|
|
35
|
-
TError =
|
|
31
|
+
TError = DefaultError,
|
|
36
32
|
TData = TQueryFnData,
|
|
37
33
|
TQueryKey extends QueryKey = QueryKey,
|
|
38
34
|
>(
|
|
@@ -42,7 +38,7 @@ export function useQuery<
|
|
|
42
38
|
|
|
43
39
|
export function useQuery<
|
|
44
40
|
TQueryFnData = unknown,
|
|
45
|
-
TError =
|
|
41
|
+
TError = DefaultError,
|
|
46
42
|
TData = TQueryFnData,
|
|
47
43
|
TQueryKey extends QueryKey = QueryKey,
|
|
48
44
|
>(
|
|
@@ -52,7 +48,7 @@ export function useQuery<
|
|
|
52
48
|
|
|
53
49
|
export function useQuery<
|
|
54
50
|
TQueryFnData = unknown,
|
|
55
|
-
TError =
|
|
51
|
+
TError = DefaultError,
|
|
56
52
|
TData = TQueryFnData,
|
|
57
53
|
TQueryKey extends QueryKey = QueryKey,
|
|
58
54
|
>(
|