@apollo/client 4.0.0-rc.3 → 4.0.0-rc.5
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/CHANGELOG.md +53 -0
- package/__cjs/cache/core/cache.cjs +2 -6
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +42 -13
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +1 -1
- package/__cjs/core/ApolloClient.cjs +45 -7
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +17 -4
- package/__cjs/core/ObservableQuery.cjs +40 -10
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +73 -9
- package/__cjs/core/types.d.cts +87 -10
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +11 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +4 -0
- package/__cjs/react/hooks/useFragment.cjs +4 -5
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +4 -7
- package/__cjs/react/hooks/useLazyQuery.d.cts +5 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +209 -10
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +270 -246
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +4 -0
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +79 -62
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +2 -2
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +185 -161
- package/__cjs/react/index.cjs +1 -3
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +0 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/types/types.documentation.d.cts +12 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs +8 -5
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/index.cjs +4 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs +14 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +3 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.cjs +3 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.cjs.map +1 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +82 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +42 -13
- package/cache/core/cache.js +2 -6
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/types.d.ts +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/core/ApolloClient.d.ts +17 -4
- package/core/ApolloClient.js +46 -8
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +73 -9
- package/core/ObservableQuery.js +40 -10
- package/core/ObservableQuery.js.map +1 -1
- package/core/types.d.ts +87 -10
- package/core/types.js.map +1 -1
- package/link/http/HttpLink.d.ts +11 -1
- package/link/http/HttpLink.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +4 -0
- package/react/hooks/useFragment.d.ts +4 -7
- package/react/hooks/useFragment.js +4 -5
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +5 -1
- package/react/hooks/useLoadableQuery.d.ts +209 -10
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +270 -246
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +4 -0
- package/react/hooks/useSubscription.d.ts +79 -62
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +2 -2
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +185 -161
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +4 -0
- package/react/hooks-compiled/useFragment.d.ts +4 -7
- package/react/hooks-compiled/useFragment.js +4 -5
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +5 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +209 -10
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +270 -246
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.d.ts +4 -0
- package/react/hooks-compiled/useSubscription.d.ts +79 -62
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseFragment.d.ts +2 -2
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +185 -161
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/index.compiled.d.ts +0 -1
- package/react/index.compiled.js +0 -1
- package/react/index.compiled.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.js +0 -1
- package/react/index.js.map +1 -1
- package/react/internal/cache/FragmentReference.js +1 -1
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/types/types.documentation.d.ts +12 -1
- package/react/types/types.documentation.js.map +1 -1
- package/utilities/internal/getStoreKeyName.js +8 -5
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/index.d.ts +2 -0
- package/utilities/internal/index.js +1 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/removeFragmentSpreads.d.ts +3 -0
- package/utilities/internal/removeFragmentSpreads.js +11 -0
- package/utilities/internal/removeFragmentSpreads.js.map +1 -0
- package/utilities/internal/types/DocumentationTypes.d.ts +82 -0
- package/utilities/internal/types/DocumentationTypes.js +2 -0
- package/utilities/internal/types/DocumentationTypes.js.map +1 -0
- package/version.js +1 -1
|
@@ -1,254 +1,278 @@
|
|
|
1
1
|
import type { ApolloClient, ApolloQueryResult, DataState, DefaultContext, DocumentNode, ErrorLike, ErrorPolicy, FetchMoreOptions, GetDataState, ObservableQuery, OperationVariables, QueryResult, RefetchWritePolicy, SubscribeToMoreFunction, TypedDocumentNode, UpdateQueryMapFn, WatchQueryFetchPolicy, WatchQueryOptions } from "@apollo/client";
|
|
2
2
|
import { NetworkStatus } from "@apollo/client";
|
|
3
3
|
import type { MaybeMasked } from "@apollo/client/masking";
|
|
4
|
-
import type { NoInfer, VariablesOption } from "@apollo/client/utilities/internal";
|
|
4
|
+
import type { DocumentationTypes as UtilityDocumentationTypes, NoInfer, VariablesOption } from "@apollo/client/utilities/internal";
|
|
5
5
|
import type { NextFetchPolicyContext } from "../../core/watchQueryOptions.cjs";
|
|
6
6
|
export declare namespace useQuery {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
7
|
+
namespace Base {
|
|
8
|
+
interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
|
9
|
+
/**
|
|
10
|
+
* Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
|
|
11
|
+
*
|
|
12
|
+
* For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
|
|
13
|
+
*
|
|
14
|
+
* The default value is `cache-first`.
|
|
15
|
+
*
|
|
16
|
+
* @docGroup
|
|
17
|
+
*
|
|
18
|
+
* 3. Caching options
|
|
19
|
+
*/
|
|
20
|
+
fetchPolicy?: WatchQueryFetchPolicy;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the `FetchPolicy` to be used after this query has completed.
|
|
23
|
+
*
|
|
24
|
+
* @docGroup
|
|
25
|
+
*
|
|
26
|
+
* 3. Caching options
|
|
27
|
+
*/
|
|
28
|
+
nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
|
|
29
|
+
/**
|
|
30
|
+
* Defaults to the initial value of options.fetchPolicy, but can be explicitly configured to specify the WatchQueryFetchPolicy to revert back to whenever variables change (unless nextFetchPolicy intervenes).
|
|
31
|
+
*
|
|
32
|
+
* @docGroup
|
|
33
|
+
*
|
|
34
|
+
* 3. Caching options
|
|
35
|
+
*/
|
|
36
|
+
initialFetchPolicy?: WatchQueryFetchPolicy;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.
|
|
39
|
+
*
|
|
40
|
+
* @docGroup
|
|
41
|
+
*
|
|
42
|
+
* 3. Caching options
|
|
43
|
+
*/
|
|
44
|
+
refetchWritePolicy?: RefetchWritePolicy;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies how the query handles a response that returns both GraphQL errors and partial results.
|
|
47
|
+
*
|
|
48
|
+
* For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
|
|
49
|
+
*
|
|
50
|
+
* The default value is `none`, meaning that the query result includes error details but not partial results.
|
|
51
|
+
*
|
|
52
|
+
* @docGroup
|
|
53
|
+
*
|
|
54
|
+
* 1. Operation options
|
|
55
|
+
*/
|
|
56
|
+
errorPolicy?: ErrorPolicy;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the interval (in milliseconds) at which the query polls for updated results.
|
|
59
|
+
*
|
|
60
|
+
* The default value is `0` (no polling).
|
|
61
|
+
*
|
|
62
|
+
* @docGroup
|
|
63
|
+
*
|
|
64
|
+
* 2. Networking options
|
|
65
|
+
*/
|
|
66
|
+
pollInterval?: number;
|
|
67
|
+
/**
|
|
68
|
+
* If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.
|
|
69
|
+
*
|
|
70
|
+
* The default value is `true`.
|
|
71
|
+
*
|
|
72
|
+
* @docGroup
|
|
73
|
+
*
|
|
74
|
+
* 2. Networking options
|
|
75
|
+
*/
|
|
76
|
+
notifyOnNetworkStatusChange?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
|
|
79
|
+
*
|
|
80
|
+
* The default value is `false`.
|
|
81
|
+
*
|
|
82
|
+
* @docGroup
|
|
83
|
+
*
|
|
84
|
+
* 3. Caching options
|
|
85
|
+
*/
|
|
86
|
+
returnPartialData?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* A callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval.
|
|
89
|
+
*
|
|
90
|
+
* @docGroup
|
|
91
|
+
*
|
|
92
|
+
* 2. Networking options
|
|
93
|
+
*/
|
|
94
|
+
skipPollAttempt?: () => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).
|
|
97
|
+
*
|
|
98
|
+
* @docGroup
|
|
99
|
+
*
|
|
100
|
+
* 2. Networking options
|
|
101
|
+
*/
|
|
102
|
+
ssr?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* The instance of `ApolloClient` to use to execute the query.
|
|
105
|
+
*
|
|
106
|
+
* By default, the instance that's passed down via context is used, but you can provide a different instance here.
|
|
107
|
+
*
|
|
108
|
+
* @docGroup
|
|
109
|
+
*
|
|
110
|
+
* 1. Operation options
|
|
111
|
+
*/
|
|
112
|
+
client?: ApolloClient;
|
|
113
|
+
/**
|
|
114
|
+
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
115
|
+
*
|
|
116
|
+
* @docGroup
|
|
117
|
+
*
|
|
118
|
+
* 2. Networking options
|
|
119
|
+
*/
|
|
120
|
+
context?: DefaultContext;
|
|
121
|
+
/**
|
|
122
|
+
* If true, the query is not executed.
|
|
123
|
+
*
|
|
124
|
+
* The default value is `false`.
|
|
125
|
+
*
|
|
126
|
+
* @docGroup
|
|
127
|
+
*
|
|
128
|
+
* 1. Operation options
|
|
129
|
+
*/
|
|
130
|
+
skip?: boolean;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
type Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> = Base.Options<TData, TVariables> & VariablesOption<TVariables>;
|
|
134
|
+
namespace DocumentationTypes {
|
|
135
|
+
interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Base.Options<TData, TVariables> {
|
|
136
|
+
/**
|
|
137
|
+
* An object containing all of the GraphQL variables your query requires to execute.
|
|
138
|
+
*
|
|
139
|
+
* Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
|
|
140
|
+
*
|
|
141
|
+
* @docGroup
|
|
142
|
+
*
|
|
143
|
+
* 1. Operation options
|
|
144
|
+
*/
|
|
145
|
+
variables?: TVariables;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
namespace Base {
|
|
149
|
+
interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
|
|
150
|
+
/**
|
|
151
|
+
* The instance of Apollo Client that executed the query. Can be useful for manually executing followup queries or writing data to the cache.
|
|
152
|
+
*
|
|
153
|
+
* @docGroup
|
|
154
|
+
*
|
|
155
|
+
* 2. Network info
|
|
156
|
+
*/
|
|
157
|
+
client: ApolloClient;
|
|
158
|
+
/**
|
|
159
|
+
* A reference to the internal `ObservableQuery` used by the hook.
|
|
160
|
+
*/
|
|
161
|
+
observable: ObservableQuery<TData, TVariables>;
|
|
162
|
+
/**
|
|
163
|
+
* An object containing the result from the most recent _previous_ execution of this query.
|
|
164
|
+
*
|
|
165
|
+
* This value is `undefined` if this is the query's first execution.
|
|
166
|
+
*
|
|
167
|
+
* @docGroup
|
|
168
|
+
*
|
|
169
|
+
* 1. Operation data
|
|
170
|
+
*/
|
|
171
|
+
previousData?: MaybeMasked<TData>;
|
|
172
|
+
/**
|
|
173
|
+
* A single ErrorLike object describing the error that occured during the latest query execution.
|
|
174
|
+
*
|
|
175
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
176
|
+
*
|
|
177
|
+
* @docGroup
|
|
178
|
+
*
|
|
179
|
+
* 1. Operation data
|
|
180
|
+
*/
|
|
181
|
+
error?: ErrorLike;
|
|
182
|
+
/**
|
|
183
|
+
* If `true`, the query is still in flight and results have not yet been returned.
|
|
184
|
+
*
|
|
185
|
+
* @docGroup
|
|
186
|
+
*
|
|
187
|
+
* 2. Network info
|
|
188
|
+
*/
|
|
189
|
+
loading: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)
|
|
192
|
+
*
|
|
193
|
+
* Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
|
|
194
|
+
*
|
|
195
|
+
* @docGroup
|
|
196
|
+
*
|
|
197
|
+
* 2. Network info
|
|
198
|
+
*/
|
|
199
|
+
networkStatus: NetworkStatus;
|
|
200
|
+
/**
|
|
201
|
+
* A function that instructs the query to begin re-executing at a specified interval (in milliseconds).
|
|
202
|
+
*
|
|
203
|
+
*
|
|
204
|
+
* @docGroup
|
|
205
|
+
*
|
|
206
|
+
* 3. Helper functions
|
|
207
|
+
*/
|
|
208
|
+
startPolling: (pollInterval: number) => void;
|
|
209
|
+
/**
|
|
210
|
+
* A function that instructs the query to stop polling after a previous call to `startPolling`.
|
|
211
|
+
*
|
|
212
|
+
*
|
|
213
|
+
* @docGroup
|
|
214
|
+
*
|
|
215
|
+
* 3. Helper functions
|
|
216
|
+
*/
|
|
217
|
+
stopPolling: () => void;
|
|
218
|
+
/**
|
|
219
|
+
* A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
|
220
|
+
*
|
|
221
|
+
* This function returns _another_ function that you can call to terminate the subscription.
|
|
222
|
+
*
|
|
223
|
+
*
|
|
224
|
+
* @docGroup
|
|
225
|
+
*
|
|
226
|
+
* 3. Helper functions
|
|
227
|
+
*/
|
|
228
|
+
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
|
229
|
+
/**
|
|
230
|
+
* A function that enables you to update the query's cached result without executing a followup GraphQL operation.
|
|
231
|
+
*
|
|
232
|
+
* See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.
|
|
233
|
+
*
|
|
234
|
+
*
|
|
235
|
+
* @docGroup
|
|
236
|
+
*
|
|
237
|
+
* 3. Helper functions
|
|
238
|
+
*/
|
|
239
|
+
updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;
|
|
240
|
+
/**
|
|
241
|
+
* A function that enables you to re-execute the query, optionally passing in new `variables`.
|
|
242
|
+
*
|
|
243
|
+
* To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).
|
|
244
|
+
*
|
|
245
|
+
* See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
|
|
246
|
+
*
|
|
247
|
+
* @docGroup
|
|
248
|
+
*
|
|
249
|
+
* 3. Helper functions
|
|
250
|
+
*/
|
|
251
|
+
refetch: (variables?: Partial<TVariables>) => Promise<QueryResult<MaybeMasked<TData>>>;
|
|
252
|
+
/**
|
|
253
|
+
* An object containing the variables that were provided for the query.
|
|
254
|
+
*
|
|
255
|
+
* @docGroup
|
|
256
|
+
*
|
|
257
|
+
* 1. Operation data
|
|
258
|
+
*/
|
|
259
|
+
variables: TVariables;
|
|
260
|
+
/**
|
|
261
|
+
* A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
|
|
262
|
+
*
|
|
263
|
+
*
|
|
264
|
+
* @docGroup
|
|
265
|
+
*
|
|
266
|
+
* 3. Helper functions
|
|
267
|
+
*/
|
|
268
|
+
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreOptions<TData, TVariables, TFetchData, TFetchVars>) => Promise<QueryResult<MaybeMasked<TFetchData>>>;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
type Result<TData = unknown, TVariables extends OperationVariables = OperationVariables, TStates extends DataState<TData>["dataState"] = DataState<TData>["dataState"]> = Base.Result<TData, TVariables> & GetDataState<MaybeMasked<TData>, TStates>;
|
|
272
|
+
namespace DocumentationTypes {
|
|
273
|
+
interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Base.Result<TData, TVariables>, UtilityDocumentationTypes.DataState<TData> {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
252
276
|
}
|
|
253
277
|
export declare function useQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
|
|
254
278
|
returnPartialData: true;
|
|
@@ -6,6 +6,10 @@ export declare namespace useQueryRefHandlers {
|
|
|
6
6
|
/**
|
|
7
7
|
* Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
|
|
8
8
|
*
|
|
9
|
+
* Returns a `ResultPromise` with an additional `.retain()` method. Calling `.retain()` keeps the network operation running even if the `ObservableQuery` no longer requires the result.
|
|
10
|
+
*
|
|
11
|
+
* Note: `refetch()` guarantees that a value will be emitted from the observable, even if the result is deep equal to the previous value.
|
|
12
|
+
*
|
|
9
13
|
* @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
|
|
10
14
|
*/
|
|
11
15
|
refetch: RefetchFunction<TData, TVariables>;
|