@tanstack/solid-query 5.71.7 → 5.71.8
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/dev.cjs +18 -17
- package/build/dev.js +16 -11
- package/build/index.cjs +18 -17
- package/build/index.d.cts +68 -40
- package/build/index.d.ts +68 -40
- package/build/index.js +16 -11
- package/package.json +1 -1
- package/src/QueryClient.ts +85 -0
- package/src/QueryClientProvider.tsx +1 -2
- package/src/{useBaseQuery.ts → createBaseQuery.ts} +4 -5
- package/src/{useInfiniteQuery.ts → createInfiniteQuery.ts} +14 -15
- package/src/{useMutation.ts → createMutation.ts} +10 -9
- package/src/{useQueries.ts → createQueries.ts} +26 -26
- package/src/{useQuery.ts → createQuery.ts} +13 -12
- package/src/index.ts +10 -46
- package/src/types.ts +26 -25
- package/src/useIsFetching.ts +2 -1
- package/src/useIsMutating.ts +2 -1
- package/src/useMutationState.ts +1 -1
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
import { useQueryClient } from './QueryClientProvider'
|
|
15
15
|
import { useIsRestoring } from './isRestoring'
|
|
16
16
|
import { noop } from './utils'
|
|
17
|
-
import type {
|
|
17
|
+
import type { CreateQueryResult, SolidQueryOptions } from './types'
|
|
18
18
|
import type { Accessor } from 'solid-js'
|
|
19
|
+
import type { QueryClient } from './QueryClient'
|
|
19
20
|
import type {
|
|
20
21
|
DefaultError,
|
|
21
22
|
OmitKeyof,
|
|
22
23
|
QueriesObserverOptions,
|
|
23
24
|
QueriesPlaceholderDataFunction,
|
|
24
|
-
QueryClient,
|
|
25
25
|
QueryFunction,
|
|
26
26
|
QueryKey,
|
|
27
27
|
QueryObserverOptions,
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
|
|
32
32
|
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.
|
|
33
33
|
// `placeholderData` function does not have a parameter
|
|
34
|
-
type
|
|
34
|
+
type CreateQueryOptionsForCreateQueries<
|
|
35
35
|
TQueryFnData = unknown,
|
|
36
36
|
TError = DefaultError,
|
|
37
37
|
TData = TQueryFnData,
|
|
@@ -43,7 +43,7 @@ type UseQueryOptionsForUseQueries<
|
|
|
43
43
|
placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>
|
|
44
44
|
/**
|
|
45
45
|
* @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
|
|
46
|
-
* The `data` property on
|
|
46
|
+
* The `data` property on createQueries is a plain object and not a SolidJS Resource.
|
|
47
47
|
* It will not suspend when the data is loading.
|
|
48
48
|
* Setting `suspense` to `true` will be a no-op.
|
|
49
49
|
*/
|
|
@@ -63,18 +63,18 @@ type GetOptions<T> =
|
|
|
63
63
|
error?: infer TError
|
|
64
64
|
data: infer TData
|
|
65
65
|
}
|
|
66
|
-
?
|
|
66
|
+
? CreateQueryOptionsForCreateQueries<TQueryFnData, TError, TData>
|
|
67
67
|
: T extends { queryFnData: infer TQueryFnData; error?: infer TError }
|
|
68
|
-
?
|
|
68
|
+
? CreateQueryOptionsForCreateQueries<TQueryFnData, TError>
|
|
69
69
|
: T extends { data: infer TData; error?: infer TError }
|
|
70
|
-
?
|
|
70
|
+
? CreateQueryOptionsForCreateQueries<unknown, TError, TData>
|
|
71
71
|
: // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]
|
|
72
72
|
T extends [infer TQueryFnData, infer TError, infer TData]
|
|
73
|
-
?
|
|
73
|
+
? CreateQueryOptionsForCreateQueries<TQueryFnData, TError, TData>
|
|
74
74
|
: T extends [infer TQueryFnData, infer TError]
|
|
75
|
-
?
|
|
75
|
+
? CreateQueryOptionsForCreateQueries<TQueryFnData, TError>
|
|
76
76
|
: T extends [infer TQueryFnData]
|
|
77
|
-
?
|
|
77
|
+
? CreateQueryOptionsForCreateQueries<TQueryFnData>
|
|
78
78
|
: // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided
|
|
79
79
|
T extends {
|
|
80
80
|
queryFn?:
|
|
@@ -83,30 +83,30 @@ type GetOptions<T> =
|
|
|
83
83
|
select?: (data: any) => infer TData
|
|
84
84
|
throwOnError?: ThrowOnError<any, infer TError, any, any>
|
|
85
85
|
}
|
|
86
|
-
?
|
|
86
|
+
? CreateQueryOptionsForCreateQueries<
|
|
87
87
|
TQueryFnData,
|
|
88
88
|
unknown extends TError ? DefaultError : TError,
|
|
89
89
|
unknown extends TData ? TQueryFnData : TData,
|
|
90
90
|
TQueryKey
|
|
91
91
|
>
|
|
92
92
|
: // Fallback
|
|
93
|
-
|
|
93
|
+
CreateQueryOptionsForCreateQueries
|
|
94
94
|
|
|
95
95
|
type GetResults<T> =
|
|
96
96
|
// Part 1: responsible for mapping explicit type parameter to function result, if object
|
|
97
97
|
T extends { queryFnData: any; error?: infer TError; data: infer TData }
|
|
98
|
-
?
|
|
98
|
+
? CreateQueryResult<TData, TError>
|
|
99
99
|
: T extends { queryFnData: infer TQueryFnData; error?: infer TError }
|
|
100
|
-
?
|
|
100
|
+
? CreateQueryResult<TQueryFnData, TError>
|
|
101
101
|
: T extends { data: infer TData; error?: infer TError }
|
|
102
|
-
?
|
|
102
|
+
? CreateQueryResult<TData, TError>
|
|
103
103
|
: // Part 2: responsible for mapping explicit type parameter to function result, if tuple
|
|
104
104
|
T extends [any, infer TError, infer TData]
|
|
105
|
-
?
|
|
105
|
+
? CreateQueryResult<TData, TError>
|
|
106
106
|
: T extends [infer TQueryFnData, infer TError]
|
|
107
|
-
?
|
|
107
|
+
? CreateQueryResult<TQueryFnData, TError>
|
|
108
108
|
: T extends [infer TQueryFnData]
|
|
109
|
-
?
|
|
109
|
+
? CreateQueryResult<TQueryFnData>
|
|
110
110
|
: // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided
|
|
111
111
|
T extends {
|
|
112
112
|
queryFn?:
|
|
@@ -115,12 +115,12 @@ type GetResults<T> =
|
|
|
115
115
|
select?: (data: any) => infer TData
|
|
116
116
|
throwOnError?: ThrowOnError<any, infer TError, any, any>
|
|
117
117
|
}
|
|
118
|
-
?
|
|
118
|
+
? CreateQueryResult<
|
|
119
119
|
unknown extends TData ? TQueryFnData : TData,
|
|
120
120
|
unknown extends TError ? DefaultError : TError
|
|
121
121
|
>
|
|
122
122
|
: // Fallback
|
|
123
|
-
|
|
123
|
+
CreateQueryResult
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param
|
|
@@ -130,7 +130,7 @@ type QueriesOptions<
|
|
|
130
130
|
TResult extends Array<any> = [],
|
|
131
131
|
TDepth extends ReadonlyArray<number> = [],
|
|
132
132
|
> = TDepth['length'] extends MAXIMUM_DEPTH
|
|
133
|
-
? Array<
|
|
133
|
+
? Array<CreateQueryOptionsForCreateQueries>
|
|
134
134
|
: T extends []
|
|
135
135
|
? []
|
|
136
136
|
: T extends [infer Head]
|
|
@@ -146,7 +146,7 @@ type QueriesOptions<
|
|
|
146
146
|
: // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!
|
|
147
147
|
// use this to infer the param types in the case of Array.map() argument
|
|
148
148
|
T extends Array<
|
|
149
|
-
|
|
149
|
+
CreateQueryOptionsForCreateQueries<
|
|
150
150
|
infer TQueryFnData,
|
|
151
151
|
infer TError,
|
|
152
152
|
infer TData,
|
|
@@ -154,7 +154,7 @@ type QueriesOptions<
|
|
|
154
154
|
>
|
|
155
155
|
>
|
|
156
156
|
? Array<
|
|
157
|
-
|
|
157
|
+
CreateQueryOptionsForCreateQueries<
|
|
158
158
|
TQueryFnData,
|
|
159
159
|
TError,
|
|
160
160
|
TData,
|
|
@@ -162,7 +162,7 @@ type QueriesOptions<
|
|
|
162
162
|
>
|
|
163
163
|
>
|
|
164
164
|
: // Fallback
|
|
165
|
-
Array<
|
|
165
|
+
Array<CreateQueryOptionsForCreateQueries>
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* QueriesResults reducer recursively maps type param to results
|
|
@@ -172,7 +172,7 @@ type QueriesResults<
|
|
|
172
172
|
TResult extends Array<any> = [],
|
|
173
173
|
TDepth extends ReadonlyArray<number> = [],
|
|
174
174
|
> = TDepth['length'] extends MAXIMUM_DEPTH
|
|
175
|
-
? Array<
|
|
175
|
+
? Array<CreateQueryResult>
|
|
176
176
|
: T extends []
|
|
177
177
|
? []
|
|
178
178
|
: T extends [infer Head]
|
|
@@ -185,7 +185,7 @@ type QueriesResults<
|
|
|
185
185
|
>
|
|
186
186
|
: { [K in keyof T]: GetResults<T[K]> }
|
|
187
187
|
|
|
188
|
-
export function
|
|
188
|
+
export function createQueries<
|
|
189
189
|
T extends Array<any>,
|
|
190
190
|
TCombinedResult extends QueriesResults<T> = QueriesResults<T>,
|
|
191
191
|
>(
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { QueryObserver } from '@tanstack/query-core'
|
|
2
2
|
import { createMemo } from 'solid-js'
|
|
3
|
-
import {
|
|
4
|
-
import type { DefaultError,
|
|
3
|
+
import { createBaseQuery } from './createBaseQuery'
|
|
4
|
+
import type { DefaultError, QueryKey } from '@tanstack/query-core'
|
|
5
|
+
import type { QueryClient } from './QueryClient'
|
|
5
6
|
import type { Accessor } from 'solid-js'
|
|
6
7
|
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
CreateQueryOptions,
|
|
9
|
+
CreateQueryResult,
|
|
10
|
+
DefinedCreateQueryResult,
|
|
10
11
|
} from './types'
|
|
11
12
|
import type {
|
|
12
13
|
DefinedInitialDataOptions,
|
|
13
14
|
UndefinedInitialDataOptions,
|
|
14
15
|
} from './queryOptions'
|
|
15
16
|
|
|
16
|
-
export function
|
|
17
|
+
export function createQuery<
|
|
17
18
|
TQueryFnData = unknown,
|
|
18
19
|
TError = DefaultError,
|
|
19
20
|
TData = TQueryFnData,
|
|
@@ -21,9 +22,9 @@ export function useQuery<
|
|
|
21
22
|
>(
|
|
22
23
|
options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
23
24
|
queryClient?: () => QueryClient,
|
|
24
|
-
):
|
|
25
|
+
): CreateQueryResult<TData, TError>
|
|
25
26
|
|
|
26
|
-
export function
|
|
27
|
+
export function createQuery<
|
|
27
28
|
TQueryFnData = unknown,
|
|
28
29
|
TError = DefaultError,
|
|
29
30
|
TData = TQueryFnData,
|
|
@@ -31,17 +32,17 @@ export function useQuery<
|
|
|
31
32
|
>(
|
|
32
33
|
options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
33
34
|
queryClient?: () => QueryClient,
|
|
34
|
-
):
|
|
35
|
-
export function
|
|
35
|
+
): DefinedCreateQueryResult<TData, TError>
|
|
36
|
+
export function createQuery<
|
|
36
37
|
TQueryFnData,
|
|
37
38
|
TError = DefaultError,
|
|
38
39
|
TData = TQueryFnData,
|
|
39
40
|
TQueryKey extends QueryKey = QueryKey,
|
|
40
41
|
>(
|
|
41
|
-
options:
|
|
42
|
+
options: CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
42
43
|
queryClient?: Accessor<QueryClient>,
|
|
43
44
|
) {
|
|
44
|
-
return
|
|
45
|
+
return createBaseQuery(
|
|
45
46
|
createMemo(() => options()),
|
|
46
47
|
QueryObserver,
|
|
47
48
|
queryClient,
|
package/src/index.ts
CHANGED
|
@@ -5,47 +5,14 @@ export * from '@tanstack/query-core'
|
|
|
5
5
|
|
|
6
6
|
// Solid Query
|
|
7
7
|
export * from './types'
|
|
8
|
-
|
|
9
|
-
export type {
|
|
10
|
-
UseQueryOptions,
|
|
11
|
-
UseBaseQueryResult,
|
|
12
|
-
UseQueryResult,
|
|
13
|
-
DefinedUseBaseQueryResult,
|
|
14
|
-
DefinedUseQueryResult,
|
|
15
|
-
UseInfiniteQueryOptions,
|
|
16
|
-
UseInfiniteQueryResult,
|
|
17
|
-
DefinedUseInfiniteQueryResult,
|
|
18
|
-
UseMutationOptions,
|
|
19
|
-
UseMutateFunction,
|
|
20
|
-
UseMutateAsyncFunction,
|
|
21
|
-
UseBaseMutationResult,
|
|
22
|
-
UseMutationResult,
|
|
23
|
-
UseBaseQueryOptions,
|
|
24
|
-
SolidQueryOptions,
|
|
25
|
-
SolidInfiniteQueryOptions,
|
|
26
|
-
SolidMutationOptions,
|
|
27
|
-
} from './types'
|
|
28
|
-
|
|
29
|
-
// Compatibility types
|
|
8
|
+
export { QueryClient } from './QueryClient'
|
|
30
9
|
export type {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
UseInfiniteQueryResult as CreateInfiniteQueryResult,
|
|
38
|
-
DefinedUseInfiniteQueryResult as DefinedCreateInfiniteQueryResult,
|
|
39
|
-
UseMutationOptions as CreateMutationOptions,
|
|
40
|
-
UseMutateFunction as CreateMutateFunction,
|
|
41
|
-
UseMutateAsyncFunction as CreateMutateAsyncFunction,
|
|
42
|
-
UseBaseMutationResult as CreateBaseMutationResult,
|
|
43
|
-
UseMutationResult as CreateMutationResult,
|
|
44
|
-
UseBaseQueryOptions as CreateBaseQueryOptions,
|
|
45
|
-
} from './types'
|
|
46
|
-
|
|
47
|
-
export { useQuery } from './useQuery'
|
|
48
|
-
export { useQuery as createQuery } from './useQuery'
|
|
10
|
+
QueryObserverOptions,
|
|
11
|
+
DefaultOptions,
|
|
12
|
+
QueryClientConfig,
|
|
13
|
+
InfiniteQueryObserverOptions,
|
|
14
|
+
} from './QueryClient'
|
|
15
|
+
export { createQuery } from './createQuery'
|
|
49
16
|
export { queryOptions } from './queryOptions'
|
|
50
17
|
export type {
|
|
51
18
|
DefinedInitialDataOptions,
|
|
@@ -58,17 +25,14 @@ export {
|
|
|
58
25
|
} from './QueryClientProvider'
|
|
59
26
|
export type { QueryClientProviderProps } from './QueryClientProvider'
|
|
60
27
|
export { useIsFetching } from './useIsFetching'
|
|
61
|
-
export {
|
|
62
|
-
export { useInfiniteQuery as createInfiniteQuery } from './useInfiniteQuery'
|
|
28
|
+
export { createInfiniteQuery } from './createInfiniteQuery'
|
|
63
29
|
export { infiniteQueryOptions } from './infiniteQueryOptions'
|
|
64
30
|
export type {
|
|
65
31
|
DefinedInitialDataInfiniteOptions,
|
|
66
32
|
UndefinedInitialDataInfiniteOptions,
|
|
67
33
|
} from './infiniteQueryOptions'
|
|
68
|
-
export {
|
|
69
|
-
export { useMutation as createMutation } from './useMutation'
|
|
34
|
+
export { createMutation } from './createMutation'
|
|
70
35
|
export { useIsMutating } from './useIsMutating'
|
|
71
36
|
export { useMutationState } from './useMutationState'
|
|
72
|
-
export {
|
|
73
|
-
export { useQueries as createQueries } from './useQueries'
|
|
37
|
+
export { createQueries } from './createQueries'
|
|
74
38
|
export { useIsRestoring, IsRestoringProvider } from './isRestoring'
|
package/src/types.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
DefaultError,
|
|
5
5
|
DefinedInfiniteQueryObserverResult,
|
|
6
6
|
DefinedQueryObserverResult,
|
|
7
|
-
InfiniteQueryObserverOptions,
|
|
8
7
|
InfiniteQueryObserverResult,
|
|
9
8
|
MutateFunction,
|
|
10
9
|
MutationObserverOptions,
|
|
@@ -12,13 +11,15 @@ import type {
|
|
|
12
11
|
OmitKeyof,
|
|
13
12
|
Override,
|
|
14
13
|
QueryKey,
|
|
15
|
-
QueryObserverOptions,
|
|
16
14
|
QueryObserverResult,
|
|
17
15
|
} from '@tanstack/query-core'
|
|
18
|
-
|
|
16
|
+
import type {
|
|
17
|
+
InfiniteQueryObserverOptions,
|
|
18
|
+
QueryObserverOptions,
|
|
19
|
+
} from './QueryClient'
|
|
19
20
|
import type { Accessor } from 'solid-js'
|
|
20
21
|
|
|
21
|
-
export interface
|
|
22
|
+
export interface CreateBaseQueryOptions<
|
|
22
23
|
TQueryFnData = unknown,
|
|
23
24
|
TError = DefaultError,
|
|
24
25
|
TData = TQueryFnData,
|
|
@@ -37,7 +38,7 @@ export interface UseBaseQueryOptions<
|
|
|
37
38
|
deferStream?: boolean
|
|
38
39
|
/**
|
|
39
40
|
* @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
|
|
40
|
-
* The `data` property on
|
|
41
|
+
* The `data` property on createQuery is a SolidJS resource and will automatically suspend when the data is loading.
|
|
41
42
|
* Setting `suspense` to `false` will be a no-op.
|
|
42
43
|
*/
|
|
43
44
|
suspense?: boolean
|
|
@@ -48,7 +49,7 @@ export interface SolidQueryOptions<
|
|
|
48
49
|
TError = DefaultError,
|
|
49
50
|
TData = TQueryFnData,
|
|
50
51
|
TQueryKey extends QueryKey = QueryKey,
|
|
51
|
-
> extends
|
|
52
|
+
> extends CreateBaseQueryOptions<
|
|
52
53
|
TQueryFnData,
|
|
53
54
|
TError,
|
|
54
55
|
TData,
|
|
@@ -56,7 +57,7 @@ export interface SolidQueryOptions<
|
|
|
56
57
|
TQueryKey
|
|
57
58
|
> {}
|
|
58
59
|
|
|
59
|
-
export type
|
|
60
|
+
export type CreateQueryOptions<
|
|
60
61
|
TQueryFnData = unknown,
|
|
61
62
|
TError = DefaultError,
|
|
62
63
|
TData = TQueryFnData,
|
|
@@ -65,25 +66,25 @@ export type UseQueryOptions<
|
|
|
65
66
|
|
|
66
67
|
/* --- Create Query and Create Base Query Types --- */
|
|
67
68
|
|
|
68
|
-
export type
|
|
69
|
+
export type CreateBaseQueryResult<
|
|
69
70
|
TData = unknown,
|
|
70
71
|
TError = DefaultError,
|
|
71
72
|
> = QueryObserverResult<TData, TError>
|
|
72
73
|
|
|
73
|
-
export type
|
|
74
|
+
export type CreateQueryResult<
|
|
74
75
|
TData = unknown,
|
|
75
76
|
TError = DefaultError,
|
|
76
|
-
> =
|
|
77
|
+
> = CreateBaseQueryResult<TData, TError>
|
|
77
78
|
|
|
78
|
-
export type
|
|
79
|
+
export type DefinedCreateBaseQueryResult<
|
|
79
80
|
TData = unknown,
|
|
80
81
|
TError = DefaultError,
|
|
81
82
|
> = DefinedQueryObserverResult<TData, TError>
|
|
82
83
|
|
|
83
|
-
export type
|
|
84
|
+
export type DefinedCreateQueryResult<
|
|
84
85
|
TData = unknown,
|
|
85
86
|
TError = DefaultError,
|
|
86
|
-
> =
|
|
87
|
+
> = DefinedCreateBaseQueryResult<TData, TError>
|
|
87
88
|
|
|
88
89
|
/* --- Create Infinite Queries Types --- */
|
|
89
90
|
export interface SolidInfiniteQueryOptions<
|
|
@@ -114,13 +115,13 @@ export interface SolidInfiniteQueryOptions<
|
|
|
114
115
|
deferStream?: boolean
|
|
115
116
|
/**
|
|
116
117
|
* @deprecated The `suspense` option has been deprecated in v5 and will be removed in the next major version.
|
|
117
|
-
* The `data` property on
|
|
118
|
+
* The `data` property on createInfiniteQuery is a SolidJS resource and will automatically suspend when the data is loading.
|
|
118
119
|
* Setting `suspense` to `false` will be a no-op.
|
|
119
120
|
*/
|
|
120
121
|
suspense?: boolean
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
export type
|
|
124
|
+
export type CreateInfiniteQueryOptions<
|
|
124
125
|
TQueryFnData = unknown,
|
|
125
126
|
TError = DefaultError,
|
|
126
127
|
TData = TQueryFnData,
|
|
@@ -137,12 +138,12 @@ export type UseInfiniteQueryOptions<
|
|
|
137
138
|
>
|
|
138
139
|
>
|
|
139
140
|
|
|
140
|
-
export type
|
|
141
|
+
export type CreateInfiniteQueryResult<
|
|
141
142
|
TData = unknown,
|
|
142
143
|
TError = DefaultError,
|
|
143
144
|
> = InfiniteQueryObserverResult<TData, TError>
|
|
144
145
|
|
|
145
|
-
export type
|
|
146
|
+
export type DefinedCreateInfiniteQueryResult<
|
|
146
147
|
TData = unknown,
|
|
147
148
|
TError = DefaultError,
|
|
148
149
|
> = DefinedInfiniteQueryObserverResult<TData, TError>
|
|
@@ -158,14 +159,14 @@ export interface SolidMutationOptions<
|
|
|
158
159
|
'_defaulted'
|
|
159
160
|
> {}
|
|
160
161
|
|
|
161
|
-
export type
|
|
162
|
+
export type CreateMutationOptions<
|
|
162
163
|
TData = unknown,
|
|
163
164
|
TError = DefaultError,
|
|
164
165
|
TVariables = void,
|
|
165
166
|
TContext = unknown,
|
|
166
167
|
> = Accessor<SolidMutationOptions<TData, TError, TVariables, TContext>>
|
|
167
168
|
|
|
168
|
-
export type
|
|
169
|
+
export type CreateMutateFunction<
|
|
169
170
|
TData = unknown,
|
|
170
171
|
TError = DefaultError,
|
|
171
172
|
TVariables = void,
|
|
@@ -174,28 +175,28 @@ export type UseMutateFunction<
|
|
|
174
175
|
...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>
|
|
175
176
|
) => void
|
|
176
177
|
|
|
177
|
-
export type
|
|
178
|
+
export type CreateMutateAsyncFunction<
|
|
178
179
|
TData = unknown,
|
|
179
180
|
TError = DefaultError,
|
|
180
181
|
TVariables = void,
|
|
181
182
|
TContext = unknown,
|
|
182
183
|
> = MutateFunction<TData, TError, TVariables, TContext>
|
|
183
184
|
|
|
184
|
-
export type
|
|
185
|
+
export type CreateBaseMutationResult<
|
|
185
186
|
TData = unknown,
|
|
186
187
|
TError = DefaultError,
|
|
187
188
|
TVariables = unknown,
|
|
188
189
|
TContext = unknown,
|
|
189
190
|
> = Override<
|
|
190
191
|
MutationObserverResult<TData, TError, TVariables, TContext>,
|
|
191
|
-
{ mutate:
|
|
192
|
+
{ mutate: CreateMutateFunction<TData, TError, TVariables, TContext> }
|
|
192
193
|
> & {
|
|
193
|
-
mutateAsync:
|
|
194
|
+
mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TContext>
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
export type
|
|
197
|
+
export type CreateMutationResult<
|
|
197
198
|
TData = unknown,
|
|
198
199
|
TError = DefaultError,
|
|
199
200
|
TVariables = unknown,
|
|
200
201
|
TContext = unknown,
|
|
201
|
-
> =
|
|
202
|
+
> = CreateBaseMutationResult<TData, TError, TVariables, TContext>
|
package/src/useIsFetching.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createMemo, createSignal, onCleanup } from 'solid-js'
|
|
2
2
|
import { useQueryClient } from './QueryClientProvider'
|
|
3
|
-
import type {
|
|
3
|
+
import type { QueryFilters } from '@tanstack/query-core'
|
|
4
|
+
import type { QueryClient } from './QueryClient'
|
|
4
5
|
import type { Accessor } from 'solid-js'
|
|
5
6
|
|
|
6
7
|
export function useIsFetching(
|
package/src/useIsMutating.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createMemo, createSignal, onCleanup } from 'solid-js'
|
|
2
2
|
import { useQueryClient } from './QueryClientProvider'
|
|
3
|
-
import type { MutationFilters
|
|
3
|
+
import type { MutationFilters } from '@tanstack/query-core'
|
|
4
|
+
import type { QueryClient } from './QueryClient'
|
|
4
5
|
import type { Accessor } from 'solid-js'
|
|
5
6
|
|
|
6
7
|
export function useIsMutating(
|
package/src/useMutationState.ts
CHANGED
|
@@ -6,9 +6,9 @@ import type {
|
|
|
6
6
|
MutationCache,
|
|
7
7
|
MutationFilters,
|
|
8
8
|
MutationState,
|
|
9
|
-
QueryClient,
|
|
10
9
|
} from '@tanstack/query-core'
|
|
11
10
|
import type { Accessor } from 'solid-js'
|
|
11
|
+
import type { QueryClient } from './QueryClient'
|
|
12
12
|
|
|
13
13
|
type MutationStateOptions<TResult = MutationState> = {
|
|
14
14
|
filters?: MutationFilters
|