@octanejs/apollo-client 0.1.0

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.
Files changed (85) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +97 -0
  3. package/package.json +77 -0
  4. package/src/index.d.ts +1 -0
  5. package/src/index.js +3 -0
  6. package/src/react/context/ApolloContext.d.ts +8 -0
  7. package/src/react/context/ApolloContext.js +21 -0
  8. package/src/react/context/ApolloProvider.d.ts +9 -0
  9. package/src/react/context/ApolloProvider.js +15 -0
  10. package/src/react/hooks/constants.d.ts +2 -0
  11. package/src/react/hooks/constants.js +1 -0
  12. package/src/react/hooks/internal/__use.d.ts +3 -0
  13. package/src/react/hooks/internal/__use.js +9 -0
  14. package/src/react/hooks/internal/index.d.ts +5 -0
  15. package/src/react/hooks/internal/index.js +6 -0
  16. package/src/react/hooks/internal/site.d.ts +2 -0
  17. package/src/react/hooks/internal/site.js +20 -0
  18. package/src/react/hooks/internal/useDeepMemo.d.ts +5 -0
  19. package/src/react/hooks/internal/useDeepMemo.js +11 -0
  20. package/src/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -0
  21. package/src/react/hooks/internal/useIsomorphicLayoutEffect.js +8 -0
  22. package/src/react/hooks/internal/useRenderGuard.d.ts +1 -0
  23. package/src/react/hooks/internal/useRenderGuard.js +14 -0
  24. package/src/react/hooks/internal/useSuspenseHookCacheKey.d.ts +13 -0
  25. package/src/react/hooks/internal/useSuspenseHookCacheKey.js +19 -0
  26. package/src/react/hooks/internal/validateSuspenseHookOptions.d.ts +4 -0
  27. package/src/react/hooks/internal/validateSuspenseHookOptions.js +16 -0
  28. package/src/react/hooks/internal/wrapHook.d.ts +77 -0
  29. package/src/react/hooks/internal/wrapHook.js +64 -0
  30. package/src/react/hooks/useApolloClient.d.ts +17 -0
  31. package/src/react/hooks/useApolloClient.js +27 -0
  32. package/src/react/hooks/useBackgroundQuery.d.ts +3061 -0
  33. package/src/react/hooks/useBackgroundQuery.js +88 -0
  34. package/src/react/hooks/useFragment.d.ts +205 -0
  35. package/src/react/hooks/useFragment.js +75 -0
  36. package/src/react/hooks/useLazyQuery.d.ts +947 -0
  37. package/src/react/hooks/useLazyQuery.js +156 -0
  38. package/src/react/hooks/useLoadableQuery.d.ts +955 -0
  39. package/src/react/hooks/useLoadableQuery.js +98 -0
  40. package/src/react/hooks/useMutation.d.ts +585 -0
  41. package/src/react/hooks/useMutation.js +121 -0
  42. package/src/react/hooks/useQuery.d.ts +1401 -0
  43. package/src/react/hooks/useQuery.js +234 -0
  44. package/src/react/hooks/useQueryRefHandlers.d.ts +85 -0
  45. package/src/react/hooks/useQueryRefHandlers.js +79 -0
  46. package/src/react/hooks/useReactiveVar.d.ts +21 -0
  47. package/src/react/hooks/useReactiveVar.js +41 -0
  48. package/src/react/hooks/useReadQuery.d.ts +104 -0
  49. package/src/react/hooks/useReadQuery.js +83 -0
  50. package/src/react/hooks/useSubscription.d.ts +289 -0
  51. package/src/react/hooks/useSubscription.js +258 -0
  52. package/src/react/hooks/useSuspenseFragment.d.ts +154 -0
  53. package/src/react/hooks/useSuspenseFragment.js +50 -0
  54. package/src/react/hooks/useSuspenseQuery.d.ts +1629 -0
  55. package/src/react/hooks/useSuspenseQuery.js +130 -0
  56. package/src/react/hooks/useSyncExternalStore.d.ts +2 -0
  57. package/src/react/hooks/useSyncExternalStore.js +125 -0
  58. package/src/react/index.d.ts +68 -0
  59. package/src/react/index.js +18 -0
  60. package/src/react/internal/cache/FragmentReference.d.ts +41 -0
  61. package/src/react/internal/cache/FragmentReference.js +117 -0
  62. package/src/react/internal/cache/QueryReference.d.ts +180 -0
  63. package/src/react/internal/cache/QueryReference.js +310 -0
  64. package/src/react/internal/cache/SuspenseCache.d.ts +38 -0
  65. package/src/react/internal/cache/SuspenseCache.js +39 -0
  66. package/src/react/internal/cache/getSuspenseCache.d.ts +26 -0
  67. package/src/react/internal/cache/getSuspenseCache.js +8 -0
  68. package/src/react/internal/cache/types.d.ts +13 -0
  69. package/src/react/internal/cache/types.js +1 -0
  70. package/src/react/internal/index.d.ts +16 -0
  71. package/src/react/internal/index.js +10 -0
  72. package/src/react/internal/types.d.ts +15 -0
  73. package/src/react/internal/types.js +1 -0
  74. package/src/react/query-preloader/createQueryPreloader.d.ts +630 -0
  75. package/src/react/query-preloader/createQueryPreloader.js +89 -0
  76. package/src/react/types/deprecated.d.ts +140 -0
  77. package/src/react/types/deprecated.js +1 -0
  78. package/src/react/types/types.documentation.d.ts +551 -0
  79. package/src/react/types/types.documentation.js +1 -0
  80. package/src/testing/index.d.ts +1 -0
  81. package/src/testing/index.js +1 -0
  82. package/src/testing/react/MockedProvider.d.ts +21 -0
  83. package/src/testing/react/MockedProvider.js +53 -0
  84. package/src/testing/react/index.d.ts +2 -0
  85. package/src/testing/react/index.js +1 -0
@@ -0,0 +1,1629 @@
1
+ import type {
2
+ ApolloClient,
3
+ DataState,
4
+ DefaultContext,
5
+ DocumentNode,
6
+ ErrorLike,
7
+ ErrorPolicy,
8
+ GetDataState,
9
+ MaybeMasked,
10
+ OperationVariables,
11
+ RefetchOn,
12
+ RefetchWritePolicy,
13
+ TypedDocumentNode,
14
+ WatchQueryFetchPolicy,
15
+ } from '@apollo/client';
16
+ import type { SubscribeToMoreFunction } from '@apollo/client';
17
+ import { NetworkStatus } from '@apollo/client';
18
+ import type { FetchMoreFunction, RefetchFunction } from '@octanejs/apollo-client/react/internal';
19
+ import type {
20
+ DocumentationTypes as UtilityDocumentationTypes,
21
+ NoInfer,
22
+ OptionWithFallback,
23
+ SignatureStyle,
24
+ VariablesOption,
25
+ } from '@apollo/client/utilities/internal';
26
+ import type { SkipToken } from './constants.js';
27
+ export declare namespace useSuspenseQuery {
28
+ type FetchPolicy = Extract<
29
+ WatchQueryFetchPolicy,
30
+ 'cache-first' | 'network-only' | 'no-cache' | 'cache-and-network'
31
+ >;
32
+ namespace Base {
33
+ interface Options<TVariables extends OperationVariables = OperationVariables> {
34
+ /**
35
+ * The instance of `ApolloClient` to use to execute the query.
36
+ *
37
+ * By default, the instance that's passed down via context is used, but you
38
+ * can provide a different instance here.
39
+ *
40
+ * @docGroup 1. Operation options
41
+ */
42
+ client?: ApolloClient;
43
+ /**
44
+ * 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.
45
+ *
46
+ * @docGroup 2. Networking options
47
+ */
48
+ context?: DefaultContext;
49
+ /**
50
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
51
+ *
52
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
53
+ *
54
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
55
+ *
56
+ * @docGroup 1. Operation options
57
+ */
58
+ errorPolicy?: ErrorPolicy;
59
+ /**
60
+ * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
61
+ *
62
+ * The default value is `false`.
63
+ *
64
+ * @docGroup 3. Caching options
65
+ */
66
+ returnPartialData?: boolean;
67
+ /**
68
+ * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions.
69
+ *
70
+ * The default value is "overwrite".
71
+ *
72
+ * @docGroup 3. Caching options
73
+ */
74
+ refetchWritePolicy?: RefetchWritePolicy;
75
+ /**
76
+ * 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).
77
+ *
78
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
79
+ *
80
+ * The default value is `cache-first`.
81
+ *
82
+ * @docGroup 3. Caching options
83
+ */
84
+ fetchPolicy?: FetchPolicy;
85
+ /**
86
+ * A unique identifier for the query. Each item in the array must be a stable
87
+ * identifier to prevent infinite fetches.
88
+ *
89
+ * This is useful when using the same query and variables combination in more
90
+ * than one component, otherwise the components may clobber each other. This
91
+ * can also be used to force the query to re-evaluate fresh.
92
+ *
93
+ * @docGroup 1. Operation options
94
+ */
95
+ queryKey?: string | number | any[];
96
+ /**
97
+ * Determines whether events trigger refetches for the query. Provide an
98
+ * object mapping each refetch event to `true` (enable), `false` (disable)
99
+ * or a callback function that returns `true`/`false` to control individual
100
+ * events. Provide `false` to disable all automatic refetch events for this
101
+ * query. Provide `true` to enable all automatic refetch events for this query.
102
+ * Provide a callback function to perform additional logic to determine
103
+ * whether to enable or disable a refetch for a query.
104
+ *
105
+ * `@remarks`
106
+ * `refetchOn` inherits from `defaultOptions.watchQuery.refetchOn`. If
107
+ * `defaultOptions.watchQuery.refetchOn` is not set, all refetch events are
108
+ * enabled by default.
109
+ *
110
+ * This option only has an effect when the client is configured with a
111
+ * `refetchEventManager`.
112
+ * @docGroup 1. Operation options
113
+ */
114
+ refetchOn?: RefetchOn.Option;
115
+ /**
116
+ * If `true`, the query is not executed. The default value is `false`.
117
+ *
118
+ * @deprecated We recommend using `skipToken` in place of the `skip` option as
119
+ * it is more type-safe.
120
+ *
121
+ * This option is deprecated and only supported to ease the migration from `useQuery`. It will be removed in a future release.
122
+ * Please use [`skipToken`](https://www.apollographql.com/docs/react/api/react/hooks#skiptoken) instead of the `skip` option as it is more type-safe.
123
+ *
124
+ * @docGroup 1. Operation options
125
+ *
126
+ *
127
+ * @example Recommended usage of `skipToken`:
128
+ *
129
+ * ```ts
130
+ * import { skipToken, useSuspenseQuery } from "@apollo/client";
131
+ *
132
+ * const { data } = useSuspenseQuery(
133
+ * query,
134
+ * id ? { variables: { id } } : skipToken
135
+ * );
136
+ * ```
137
+ */
138
+ skip?: boolean;
139
+ }
140
+ }
141
+ type Options<TVariables extends OperationVariables = OperationVariables> =
142
+ Base.Options<TVariables> & VariablesOption<TVariables>;
143
+ namespace DocumentationTypes {
144
+ namespace useSuspenseQuery {
145
+ interface Options<TVariables extends OperationVariables = OperationVariables>
146
+ extends Base.Options<TVariables>, UtilityDocumentationTypes.VariableOptions<TVariables> {}
147
+ }
148
+ }
149
+ namespace Base {
150
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
151
+ /**
152
+ * The instance of `ApolloClient` to use to execute the query.
153
+ *
154
+ * By default, the instance that's passed down via context is used, but you
155
+ * can provide a different instance here.
156
+ *
157
+ * @docGroup 1. Operation options
158
+ */
159
+ client: ApolloClient;
160
+ /**
161
+ * A single ErrorLike object describing the error that occurred during the latest
162
+ * query execution.
163
+ *
164
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
165
+ *
166
+ * @docGroup 1. Operation data
167
+ */
168
+ error: ErrorLike | undefined;
169
+ /**
170
+ * 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/).
171
+ *
172
+ *
173
+ * @docGroup 3. Helper functions
174
+ *
175
+ *
176
+ * @remarks
177
+ * Calling this function will cause the component to re-suspend, unless the call site is wrapped in [`startTransition`](https://react.dev/reference/react/startTransition).
178
+ */
179
+ fetchMore: FetchMoreFunction<TData, TVariables>;
180
+ /**
181
+ * 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)
182
+ *
183
+ * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
184
+ *
185
+ * @docGroup 2. Network info
186
+ */
187
+ networkStatus: NetworkStatus;
188
+ /**
189
+ * A function that enables you to re-execute the query, optionally passing in new `variables`.
190
+ *
191
+ * 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).
192
+ *
193
+ * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
194
+ *
195
+ * Returns a `ResultPromise` with an additional `.retain()` method. Calling
196
+ * `.retain()` keeps the network operation running even if the `ObservableQuery`
197
+ * no longer requires the result.
198
+ *
199
+ * @docGroup 3. Helper functions
200
+ *
201
+ *
202
+ * @remarks
203
+ * Calling this function will cause the component to re-suspend, unless the call site is wrapped in [`startTransition`](https://react.dev/reference/react/startTransition).
204
+ */
205
+ refetch: RefetchFunction<TData, TVariables>;
206
+ /**
207
+ * 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.
208
+ *
209
+ * This function returns _another_ function that you can call to terminate the subscription.
210
+ *
211
+ *
212
+ * @docGroup 3. Helper functions
213
+ */
214
+ subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
215
+ }
216
+ }
217
+ type Result<
218
+ TData = unknown,
219
+ TVariables extends OperationVariables = OperationVariables,
220
+ TStates extends DataState<TData>['dataState'] = DataState<TData>['dataState'],
221
+ > = Base.Result<TData, TVariables> & GetDataState<MaybeMasked<TData>, TStates>;
222
+ interface DefaultOptions extends ApolloClient.DefaultOptions.WatchQuery.Calculated {
223
+ skip: false;
224
+ }
225
+ type ResultForOptions<
226
+ TData,
227
+ TVariables extends OperationVariables,
228
+ TOptions extends Record<string, never> | Options<TVariables> | SkipToken,
229
+ > = Result<
230
+ TData,
231
+ TVariables,
232
+ | 'complete'
233
+ | 'streaming'
234
+ | (TOptions extends any
235
+ ? TOptions extends SkipToken
236
+ ? 'empty'
237
+ :
238
+ | (OptionWithFallback<TOptions, DefaultOptions, 'errorPolicy'> extends 'none'
239
+ ? never
240
+ : 'empty')
241
+ | (OptionWithFallback<TOptions, DefaultOptions, 'skip'> extends false
242
+ ? never
243
+ : 'empty')
244
+ | (OptionWithFallback<TOptions, DefaultOptions, 'returnPartialData'> extends false
245
+ ? never
246
+ : 'partial')
247
+ : never)
248
+ | ([TOptions] extends [SkipToken]
249
+ ? DefaultOptions extends {
250
+ returnPartialData: false;
251
+ }
252
+ ? never
253
+ : 'partial'
254
+ : never)
255
+ >;
256
+ namespace DocumentationTypes {
257
+ namespace useSuspenseQuery {
258
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables>
259
+ extends Base.Result<TData, TVariables>, UtilityDocumentationTypes.DataState<TData> {}
260
+ }
261
+ }
262
+ namespace DocumentationTypes {
263
+ interface useSuspenseQuery {
264
+ /**
265
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
266
+ *
267
+ * @example
268
+ *
269
+ * ```jsx
270
+ * import { Suspense } from "octane";
271
+ * import { useSuspenseQuery } from "@apollo/client";
272
+ *
273
+ * const listQuery = gql`
274
+ * query {
275
+ * list {
276
+ * id
277
+ * }
278
+ * }
279
+ * `;
280
+ *
281
+ * function App() {
282
+ * return (
283
+ * <Suspense fallback={<Spinner />}>
284
+ * <List />
285
+ * </Suspense>
286
+ * );
287
+ * }
288
+ *
289
+ * function List() {
290
+ * const { data } = useSuspenseQuery(listQuery);
291
+ *
292
+ * return (
293
+ * <ol>
294
+ * {data.list.map((item) => (
295
+ * <Item key={item.id} id={item.id} />
296
+ * ))}
297
+ * </ol>
298
+ * );
299
+ * }
300
+ * ```
301
+ *
302
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
303
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
304
+ */
305
+ <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
306
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
307
+ options?: useSuspenseQuery.Options<TVariables>,
308
+ ): useSuspenseQuery.Result<TData, TVariables>;
309
+ }
310
+ interface useSuspenseQuery_Deprecated {
311
+ /**
312
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
313
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
314
+ *
315
+ *
316
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
317
+ *
318
+ * @example
319
+ *
320
+ * ```jsx
321
+ * import { Suspense } from "octane";
322
+ * import { useSuspenseQuery } from "@apollo/client";
323
+ *
324
+ * const listQuery = gql`
325
+ * query {
326
+ * list {
327
+ * id
328
+ * }
329
+ * }
330
+ * `;
331
+ *
332
+ * function App() {
333
+ * return (
334
+ * <Suspense fallback={<Spinner />}>
335
+ * <List />
336
+ * </Suspense>
337
+ * );
338
+ * }
339
+ *
340
+ * function List() {
341
+ * const { data } = useSuspenseQuery(listQuery);
342
+ *
343
+ * return (
344
+ * <ol>
345
+ * {data.list.map((item) => (
346
+ * <Item key={item.id} id={item.id} />
347
+ * ))}
348
+ * </ol>
349
+ * );
350
+ * }
351
+ * ```
352
+ *
353
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
354
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
355
+ */
356
+ <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
357
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
358
+ options?: useSuspenseQuery.Options<TVariables>,
359
+ ): useSuspenseQuery.Result<TData, TVariables>;
360
+ }
361
+ }
362
+ namespace Signatures {
363
+ /**
364
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
365
+ *
366
+ * @example
367
+ *
368
+ * ```jsx
369
+ * import { Suspense } from "octane";
370
+ * import { useSuspenseQuery } from "@apollo/client";
371
+ *
372
+ * const listQuery = gql`
373
+ * query {
374
+ * list {
375
+ * id
376
+ * }
377
+ * }
378
+ * `;
379
+ *
380
+ * function App() {
381
+ * return (
382
+ * <Suspense fallback={<Spinner />}>
383
+ * <List />
384
+ * </Suspense>
385
+ * );
386
+ * }
387
+ *
388
+ * function List() {
389
+ * const { data } = useSuspenseQuery(listQuery);
390
+ *
391
+ * return (
392
+ * <ol>
393
+ * {data.list.map((item) => (
394
+ * <Item key={item.id} id={item.id} />
395
+ * ))}
396
+ * </ol>
397
+ * );
398
+ * }
399
+ * ```
400
+ *
401
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
402
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
403
+ */
404
+ interface Classic {
405
+ /**
406
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
407
+ *
408
+ * @example
409
+ *
410
+ * ```jsx
411
+ * import { Suspense } from "octane";
412
+ * import { useSuspenseQuery } from "@apollo/client";
413
+ *
414
+ * const listQuery = gql`
415
+ * query {
416
+ * list {
417
+ * id
418
+ * }
419
+ * }
420
+ * `;
421
+ *
422
+ * function App() {
423
+ * return (
424
+ * <Suspense fallback={<Spinner />}>
425
+ * <List />
426
+ * </Suspense>
427
+ * );
428
+ * }
429
+ *
430
+ * function List() {
431
+ * const { data } = useSuspenseQuery(listQuery);
432
+ *
433
+ * return (
434
+ * <ol>
435
+ * {data.list.map((item) => (
436
+ * <Item key={item.id} id={item.id} />
437
+ * ))}
438
+ * </ol>
439
+ * );
440
+ * }
441
+ * ```
442
+ *
443
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
444
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
445
+ */
446
+ <
447
+ TData,
448
+ TVariables extends OperationVariables,
449
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
450
+ >(
451
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
452
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
453
+ returnPartialData: true;
454
+ errorPolicy: 'ignore' | 'all';
455
+ },
456
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'partial' | 'empty'>;
457
+ /**
458
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
459
+ *
460
+ * @example
461
+ *
462
+ * ```jsx
463
+ * import { Suspense } from "octane";
464
+ * import { useSuspenseQuery } from "@apollo/client";
465
+ *
466
+ * const listQuery = gql`
467
+ * query {
468
+ * list {
469
+ * id
470
+ * }
471
+ * }
472
+ * `;
473
+ *
474
+ * function App() {
475
+ * return (
476
+ * <Suspense fallback={<Spinner />}>
477
+ * <List />
478
+ * </Suspense>
479
+ * );
480
+ * }
481
+ *
482
+ * function List() {
483
+ * const { data } = useSuspenseQuery(listQuery);
484
+ *
485
+ * return (
486
+ * <ol>
487
+ * {data.list.map((item) => (
488
+ * <Item key={item.id} id={item.id} />
489
+ * ))}
490
+ * </ol>
491
+ * );
492
+ * }
493
+ * ```
494
+ *
495
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
496
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
497
+ */
498
+ <
499
+ TData,
500
+ TVariables extends OperationVariables,
501
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
502
+ >(
503
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
504
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
505
+ errorPolicy: 'ignore' | 'all';
506
+ },
507
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
508
+ /**
509
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
510
+ *
511
+ * @example
512
+ *
513
+ * ```jsx
514
+ * import { Suspense } from "octane";
515
+ * import { useSuspenseQuery } from "@apollo/client";
516
+ *
517
+ * const listQuery = gql`
518
+ * query {
519
+ * list {
520
+ * id
521
+ * }
522
+ * }
523
+ * `;
524
+ *
525
+ * function App() {
526
+ * return (
527
+ * <Suspense fallback={<Spinner />}>
528
+ * <List />
529
+ * </Suspense>
530
+ * );
531
+ * }
532
+ *
533
+ * function List() {
534
+ * const { data } = useSuspenseQuery(listQuery);
535
+ *
536
+ * return (
537
+ * <ol>
538
+ * {data.list.map((item) => (
539
+ * <Item key={item.id} id={item.id} />
540
+ * ))}
541
+ * </ol>
542
+ * );
543
+ * }
544
+ * ```
545
+ *
546
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
547
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
548
+ */
549
+ <
550
+ TData,
551
+ TVariables extends OperationVariables,
552
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
553
+ >(
554
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
555
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
556
+ skip: boolean;
557
+ returnPartialData: true;
558
+ },
559
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'empty' | 'streaming' | 'partial'>;
560
+ /**
561
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
562
+ *
563
+ * @example
564
+ *
565
+ * ```jsx
566
+ * import { Suspense } from "octane";
567
+ * import { useSuspenseQuery } from "@apollo/client";
568
+ *
569
+ * const listQuery = gql`
570
+ * query {
571
+ * list {
572
+ * id
573
+ * }
574
+ * }
575
+ * `;
576
+ *
577
+ * function App() {
578
+ * return (
579
+ * <Suspense fallback={<Spinner />}>
580
+ * <List />
581
+ * </Suspense>
582
+ * );
583
+ * }
584
+ *
585
+ * function List() {
586
+ * const { data } = useSuspenseQuery(listQuery);
587
+ *
588
+ * return (
589
+ * <ol>
590
+ * {data.list.map((item) => (
591
+ * <Item key={item.id} id={item.id} />
592
+ * ))}
593
+ * </ol>
594
+ * );
595
+ * }
596
+ * ```
597
+ *
598
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
599
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
600
+ */
601
+ <
602
+ TData,
603
+ TVariables extends OperationVariables,
604
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
605
+ >(
606
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
607
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
608
+ returnPartialData: true;
609
+ },
610
+ ): useSuspenseQuery.Result<TData, TVariables, 'partial' | 'streaming' | 'complete'>;
611
+ /**
612
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
613
+ *
614
+ * @example
615
+ *
616
+ * ```jsx
617
+ * import { Suspense } from "octane";
618
+ * import { useSuspenseQuery } from "@apollo/client";
619
+ *
620
+ * const listQuery = gql`
621
+ * query {
622
+ * list {
623
+ * id
624
+ * }
625
+ * }
626
+ * `;
627
+ *
628
+ * function App() {
629
+ * return (
630
+ * <Suspense fallback={<Spinner />}>
631
+ * <List />
632
+ * </Suspense>
633
+ * );
634
+ * }
635
+ *
636
+ * function List() {
637
+ * const { data } = useSuspenseQuery(listQuery);
638
+ *
639
+ * return (
640
+ * <ol>
641
+ * {data.list.map((item) => (
642
+ * <Item key={item.id} id={item.id} />
643
+ * ))}
644
+ * </ol>
645
+ * );
646
+ * }
647
+ * ```
648
+ *
649
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
650
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
651
+ */
652
+ <
653
+ TData,
654
+ TVariables extends OperationVariables,
655
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
656
+ >(
657
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
658
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
659
+ skip: boolean;
660
+ },
661
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
662
+ /**
663
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
664
+ *
665
+ * @example
666
+ *
667
+ * ```jsx
668
+ * import { Suspense } from "octane";
669
+ * import { useSuspenseQuery } from "@apollo/client";
670
+ *
671
+ * const listQuery = gql`
672
+ * query {
673
+ * list {
674
+ * id
675
+ * }
676
+ * }
677
+ * `;
678
+ *
679
+ * function App() {
680
+ * return (
681
+ * <Suspense fallback={<Spinner />}>
682
+ * <List />
683
+ * </Suspense>
684
+ * );
685
+ * }
686
+ *
687
+ * function List() {
688
+ * const { data } = useSuspenseQuery(listQuery);
689
+ *
690
+ * return (
691
+ * <ol>
692
+ * {data.list.map((item) => (
693
+ * <Item key={item.id} id={item.id} />
694
+ * ))}
695
+ * </ol>
696
+ * );
697
+ * }
698
+ * ```
699
+ *
700
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
701
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
702
+ */
703
+ <
704
+ TData,
705
+ TVariables extends OperationVariables,
706
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
707
+ >(
708
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
709
+ options:
710
+ | SkipToken
711
+ | (useSuspenseQuery.Options<NoInfer<TVariables>> & {
712
+ returnPartialData: true;
713
+ }),
714
+ ): useSuspenseQuery.Result<TData, TVariables, 'empty' | 'streaming' | 'complete' | 'partial'>;
715
+ /**
716
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
717
+ *
718
+ * @example
719
+ *
720
+ * ```jsx
721
+ * import { Suspense } from "octane";
722
+ * import { useSuspenseQuery } from "@apollo/client";
723
+ *
724
+ * const listQuery = gql`
725
+ * query {
726
+ * list {
727
+ * id
728
+ * }
729
+ * }
730
+ * `;
731
+ *
732
+ * function App() {
733
+ * return (
734
+ * <Suspense fallback={<Spinner />}>
735
+ * <List />
736
+ * </Suspense>
737
+ * );
738
+ * }
739
+ *
740
+ * function List() {
741
+ * const { data } = useSuspenseQuery(listQuery);
742
+ *
743
+ * return (
744
+ * <ol>
745
+ * {data.list.map((item) => (
746
+ * <Item key={item.id} id={item.id} />
747
+ * ))}
748
+ * </ol>
749
+ * );
750
+ * }
751
+ * ```
752
+ *
753
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
754
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
755
+ */
756
+ <
757
+ TData,
758
+ TVariables extends OperationVariables,
759
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
760
+ >(
761
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
762
+ ...[options]: {} extends TVariables
763
+ ? [options?: useSuspenseQuery.Options<NoInfer<TVariables>>]
764
+ : [options: useSuspenseQuery.Options<NoInfer<TVariables>>]
765
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming'>;
766
+ /**
767
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
768
+ *
769
+ * @example
770
+ *
771
+ * ```jsx
772
+ * import { Suspense } from "octane";
773
+ * import { useSuspenseQuery } from "@apollo/client";
774
+ *
775
+ * const listQuery = gql`
776
+ * query {
777
+ * list {
778
+ * id
779
+ * }
780
+ * }
781
+ * `;
782
+ *
783
+ * function App() {
784
+ * return (
785
+ * <Suspense fallback={<Spinner />}>
786
+ * <List />
787
+ * </Suspense>
788
+ * );
789
+ * }
790
+ *
791
+ * function List() {
792
+ * const { data } = useSuspenseQuery(listQuery);
793
+ *
794
+ * return (
795
+ * <ol>
796
+ * {data.list.map((item) => (
797
+ * <Item key={item.id} id={item.id} />
798
+ * ))}
799
+ * </ol>
800
+ * );
801
+ * }
802
+ * ```
803
+ *
804
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
805
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
806
+ */
807
+ <
808
+ TData,
809
+ TVariables extends OperationVariables,
810
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
811
+ >(
812
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
813
+ ...[options]: {} extends TVariables
814
+ ? [options?: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>]
815
+ : [options: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>]
816
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
817
+ /**
818
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
819
+ *
820
+ * @example
821
+ *
822
+ * ```jsx
823
+ * import { Suspense } from "octane";
824
+ * import { useSuspenseQuery } from "@apollo/client";
825
+ *
826
+ * const listQuery = gql`
827
+ * query {
828
+ * list {
829
+ * id
830
+ * }
831
+ * }
832
+ * `;
833
+ *
834
+ * function App() {
835
+ * return (
836
+ * <Suspense fallback={<Spinner />}>
837
+ * <List />
838
+ * </Suspense>
839
+ * );
840
+ * }
841
+ *
842
+ * function List() {
843
+ * const { data } = useSuspenseQuery(listQuery);
844
+ *
845
+ * return (
846
+ * <ol>
847
+ * {data.list.map((item) => (
848
+ * <Item key={item.id} id={item.id} />
849
+ * ))}
850
+ * </ol>
851
+ * );
852
+ * }
853
+ * ```
854
+ *
855
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
856
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
857
+ */
858
+ <
859
+ TData,
860
+ TVariables extends OperationVariables,
861
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
862
+ >(
863
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
864
+ options: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>,
865
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
866
+ /**
867
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
868
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
869
+ *
870
+ *
871
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
872
+ *
873
+ * @example
874
+ *
875
+ * ```jsx
876
+ * import { Suspense } from "octane";
877
+ * import { useSuspenseQuery } from "@apollo/client";
878
+ *
879
+ * const listQuery = gql`
880
+ * query {
881
+ * list {
882
+ * id
883
+ * }
884
+ * }
885
+ * `;
886
+ *
887
+ * function App() {
888
+ * return (
889
+ * <Suspense fallback={<Spinner />}>
890
+ * <List />
891
+ * </Suspense>
892
+ * );
893
+ * }
894
+ *
895
+ * function List() {
896
+ * const { data } = useSuspenseQuery(listQuery);
897
+ *
898
+ * return (
899
+ * <ol>
900
+ * {data.list.map((item) => (
901
+ * <Item key={item.id} id={item.id} />
902
+ * ))}
903
+ * </ol>
904
+ * );
905
+ * }
906
+ * ```
907
+ *
908
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
909
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
910
+ */
911
+ <TData, TVariables extends OperationVariables = OperationVariables>(
912
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
913
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
914
+ returnPartialData: true;
915
+ errorPolicy: 'ignore' | 'all';
916
+ },
917
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'partial' | 'empty'>;
918
+ /**
919
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
920
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
921
+ *
922
+ *
923
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
924
+ *
925
+ * @example
926
+ *
927
+ * ```jsx
928
+ * import { Suspense } from "octane";
929
+ * import { useSuspenseQuery } from "@apollo/client";
930
+ *
931
+ * const listQuery = gql`
932
+ * query {
933
+ * list {
934
+ * id
935
+ * }
936
+ * }
937
+ * `;
938
+ *
939
+ * function App() {
940
+ * return (
941
+ * <Suspense fallback={<Spinner />}>
942
+ * <List />
943
+ * </Suspense>
944
+ * );
945
+ * }
946
+ *
947
+ * function List() {
948
+ * const { data } = useSuspenseQuery(listQuery);
949
+ *
950
+ * return (
951
+ * <ol>
952
+ * {data.list.map((item) => (
953
+ * <Item key={item.id} id={item.id} />
954
+ * ))}
955
+ * </ol>
956
+ * );
957
+ * }
958
+ * ```
959
+ *
960
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
961
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
962
+ */
963
+ <TData, TVariables extends OperationVariables = OperationVariables>(
964
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
965
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
966
+ errorPolicy: 'ignore' | 'all';
967
+ },
968
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
969
+ /**
970
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
971
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
972
+ *
973
+ *
974
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
975
+ *
976
+ * @example
977
+ *
978
+ * ```jsx
979
+ * import { Suspense } from "octane";
980
+ * import { useSuspenseQuery } from "@apollo/client";
981
+ *
982
+ * const listQuery = gql`
983
+ * query {
984
+ * list {
985
+ * id
986
+ * }
987
+ * }
988
+ * `;
989
+ *
990
+ * function App() {
991
+ * return (
992
+ * <Suspense fallback={<Spinner />}>
993
+ * <List />
994
+ * </Suspense>
995
+ * );
996
+ * }
997
+ *
998
+ * function List() {
999
+ * const { data } = useSuspenseQuery(listQuery);
1000
+ *
1001
+ * return (
1002
+ * <ol>
1003
+ * {data.list.map((item) => (
1004
+ * <Item key={item.id} id={item.id} />
1005
+ * ))}
1006
+ * </ol>
1007
+ * );
1008
+ * }
1009
+ * ```
1010
+ *
1011
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1012
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1013
+ */
1014
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1015
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1016
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
1017
+ skip: boolean;
1018
+ returnPartialData: true;
1019
+ },
1020
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'empty' | 'streaming' | 'partial'>;
1021
+ /**
1022
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1023
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1024
+ *
1025
+ *
1026
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1027
+ *
1028
+ * @example
1029
+ *
1030
+ * ```jsx
1031
+ * import { Suspense } from "octane";
1032
+ * import { useSuspenseQuery } from "@apollo/client";
1033
+ *
1034
+ * const listQuery = gql`
1035
+ * query {
1036
+ * list {
1037
+ * id
1038
+ * }
1039
+ * }
1040
+ * `;
1041
+ *
1042
+ * function App() {
1043
+ * return (
1044
+ * <Suspense fallback={<Spinner />}>
1045
+ * <List />
1046
+ * </Suspense>
1047
+ * );
1048
+ * }
1049
+ *
1050
+ * function List() {
1051
+ * const { data } = useSuspenseQuery(listQuery);
1052
+ *
1053
+ * return (
1054
+ * <ol>
1055
+ * {data.list.map((item) => (
1056
+ * <Item key={item.id} id={item.id} />
1057
+ * ))}
1058
+ * </ol>
1059
+ * );
1060
+ * }
1061
+ * ```
1062
+ *
1063
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1064
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1065
+ */
1066
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1067
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1068
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
1069
+ returnPartialData: true;
1070
+ },
1071
+ ): useSuspenseQuery.Result<TData, TVariables, 'partial' | 'streaming' | 'complete'>;
1072
+ /**
1073
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1074
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1075
+ *
1076
+ *
1077
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1078
+ *
1079
+ * @example
1080
+ *
1081
+ * ```jsx
1082
+ * import { Suspense } from "octane";
1083
+ * import { useSuspenseQuery } from "@apollo/client";
1084
+ *
1085
+ * const listQuery = gql`
1086
+ * query {
1087
+ * list {
1088
+ * id
1089
+ * }
1090
+ * }
1091
+ * `;
1092
+ *
1093
+ * function App() {
1094
+ * return (
1095
+ * <Suspense fallback={<Spinner />}>
1096
+ * <List />
1097
+ * </Suspense>
1098
+ * );
1099
+ * }
1100
+ *
1101
+ * function List() {
1102
+ * const { data } = useSuspenseQuery(listQuery);
1103
+ *
1104
+ * return (
1105
+ * <ol>
1106
+ * {data.list.map((item) => (
1107
+ * <Item key={item.id} id={item.id} />
1108
+ * ))}
1109
+ * </ol>
1110
+ * );
1111
+ * }
1112
+ * ```
1113
+ *
1114
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1115
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1116
+ */
1117
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1118
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1119
+ options: useSuspenseQuery.Options<NoInfer<TVariables>> & {
1120
+ skip: boolean;
1121
+ },
1122
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
1123
+ /**
1124
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1125
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1126
+ *
1127
+ *
1128
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1129
+ *
1130
+ * @example
1131
+ *
1132
+ * ```jsx
1133
+ * import { Suspense } from "octane";
1134
+ * import { useSuspenseQuery } from "@apollo/client";
1135
+ *
1136
+ * const listQuery = gql`
1137
+ * query {
1138
+ * list {
1139
+ * id
1140
+ * }
1141
+ * }
1142
+ * `;
1143
+ *
1144
+ * function App() {
1145
+ * return (
1146
+ * <Suspense fallback={<Spinner />}>
1147
+ * <List />
1148
+ * </Suspense>
1149
+ * );
1150
+ * }
1151
+ *
1152
+ * function List() {
1153
+ * const { data } = useSuspenseQuery(listQuery);
1154
+ *
1155
+ * return (
1156
+ * <ol>
1157
+ * {data.list.map((item) => (
1158
+ * <Item key={item.id} id={item.id} />
1159
+ * ))}
1160
+ * </ol>
1161
+ * );
1162
+ * }
1163
+ * ```
1164
+ *
1165
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1166
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1167
+ */
1168
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1169
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1170
+ options:
1171
+ | SkipToken
1172
+ | (useSuspenseQuery.Options<NoInfer<TVariables>> & {
1173
+ returnPartialData: true;
1174
+ }),
1175
+ ): useSuspenseQuery.Result<TData, TVariables, 'empty' | 'streaming' | 'complete' | 'partial'>;
1176
+ /**
1177
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1178
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1179
+ *
1180
+ *
1181
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1182
+ *
1183
+ * @example
1184
+ *
1185
+ * ```jsx
1186
+ * import { Suspense } from "octane";
1187
+ * import { useSuspenseQuery } from "@apollo/client";
1188
+ *
1189
+ * const listQuery = gql`
1190
+ * query {
1191
+ * list {
1192
+ * id
1193
+ * }
1194
+ * }
1195
+ * `;
1196
+ *
1197
+ * function App() {
1198
+ * return (
1199
+ * <Suspense fallback={<Spinner />}>
1200
+ * <List />
1201
+ * </Suspense>
1202
+ * );
1203
+ * }
1204
+ *
1205
+ * function List() {
1206
+ * const { data } = useSuspenseQuery(listQuery);
1207
+ *
1208
+ * return (
1209
+ * <ol>
1210
+ * {data.list.map((item) => (
1211
+ * <Item key={item.id} id={item.id} />
1212
+ * ))}
1213
+ * </ol>
1214
+ * );
1215
+ * }
1216
+ * ```
1217
+ *
1218
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1219
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1220
+ */
1221
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1222
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1223
+ ...[options]: {} extends TVariables
1224
+ ? [options?: useSuspenseQuery.Options<NoInfer<TVariables>>]
1225
+ : [options: useSuspenseQuery.Options<NoInfer<TVariables>>]
1226
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming'>;
1227
+ /**
1228
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1229
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1230
+ *
1231
+ *
1232
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1233
+ *
1234
+ * @example
1235
+ *
1236
+ * ```jsx
1237
+ * import { Suspense } from "octane";
1238
+ * import { useSuspenseQuery } from "@apollo/client";
1239
+ *
1240
+ * const listQuery = gql`
1241
+ * query {
1242
+ * list {
1243
+ * id
1244
+ * }
1245
+ * }
1246
+ * `;
1247
+ *
1248
+ * function App() {
1249
+ * return (
1250
+ * <Suspense fallback={<Spinner />}>
1251
+ * <List />
1252
+ * </Suspense>
1253
+ * );
1254
+ * }
1255
+ *
1256
+ * function List() {
1257
+ * const { data } = useSuspenseQuery(listQuery);
1258
+ *
1259
+ * return (
1260
+ * <ol>
1261
+ * {data.list.map((item) => (
1262
+ * <Item key={item.id} id={item.id} />
1263
+ * ))}
1264
+ * </ol>
1265
+ * );
1266
+ * }
1267
+ * ```
1268
+ *
1269
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1270
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1271
+ */
1272
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1273
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1274
+ ...[options]: {} extends TVariables
1275
+ ? [options?: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>]
1276
+ : [options: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>]
1277
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
1278
+ /**
1279
+ * @deprecated Avoid manually specifying generic arguments on `useSuspenseQuery`.
1280
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1281
+ *
1282
+ *
1283
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1284
+ *
1285
+ * @example
1286
+ *
1287
+ * ```jsx
1288
+ * import { Suspense } from "octane";
1289
+ * import { useSuspenseQuery } from "@apollo/client";
1290
+ *
1291
+ * const listQuery = gql`
1292
+ * query {
1293
+ * list {
1294
+ * id
1295
+ * }
1296
+ * }
1297
+ * `;
1298
+ *
1299
+ * function App() {
1300
+ * return (
1301
+ * <Suspense fallback={<Spinner />}>
1302
+ * <List />
1303
+ * </Suspense>
1304
+ * );
1305
+ * }
1306
+ *
1307
+ * function List() {
1308
+ * const { data } = useSuspenseQuery(listQuery);
1309
+ *
1310
+ * return (
1311
+ * <ol>
1312
+ * {data.list.map((item) => (
1313
+ * <Item key={item.id} id={item.id} />
1314
+ * ))}
1315
+ * </ol>
1316
+ * );
1317
+ * }
1318
+ * ```
1319
+ *
1320
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1321
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1322
+ */
1323
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1324
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1325
+ options: SkipToken | useSuspenseQuery.Options<NoInfer<TVariables>>,
1326
+ ): useSuspenseQuery.Result<TData, TVariables, 'complete' | 'streaming' | 'empty'>;
1327
+ }
1328
+ /**
1329
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1330
+ *
1331
+ * @example
1332
+ *
1333
+ * ```jsx
1334
+ * import { Suspense } from "octane";
1335
+ * import { useSuspenseQuery } from "@apollo/client";
1336
+ *
1337
+ * const listQuery = gql`
1338
+ * query {
1339
+ * list {
1340
+ * id
1341
+ * }
1342
+ * }
1343
+ * `;
1344
+ *
1345
+ * function App() {
1346
+ * return (
1347
+ * <Suspense fallback={<Spinner />}>
1348
+ * <List />
1349
+ * </Suspense>
1350
+ * );
1351
+ * }
1352
+ *
1353
+ * function List() {
1354
+ * const { data } = useSuspenseQuery(listQuery);
1355
+ *
1356
+ * return (
1357
+ * <ol>
1358
+ * {data.list.map((item) => (
1359
+ * <Item key={item.id} id={item.id} />
1360
+ * ))}
1361
+ * </ol>
1362
+ * );
1363
+ * }
1364
+ * ```
1365
+ *
1366
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1367
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1368
+ */
1369
+ interface Modern {
1370
+ /**
1371
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1372
+ *
1373
+ * @example
1374
+ *
1375
+ * ```jsx
1376
+ * import { Suspense } from "octane";
1377
+ * import { useSuspenseQuery } from "@apollo/client";
1378
+ *
1379
+ * const listQuery = gql`
1380
+ * query {
1381
+ * list {
1382
+ * id
1383
+ * }
1384
+ * }
1385
+ * `;
1386
+ *
1387
+ * function App() {
1388
+ * return (
1389
+ * <Suspense fallback={<Spinner />}>
1390
+ * <List />
1391
+ * </Suspense>
1392
+ * );
1393
+ * }
1394
+ *
1395
+ * function List() {
1396
+ * const { data } = useSuspenseQuery(listQuery);
1397
+ *
1398
+ * return (
1399
+ * <ol>
1400
+ * {data.list.map((item) => (
1401
+ * <Item key={item.id} id={item.id} />
1402
+ * ))}
1403
+ * </ol>
1404
+ * );
1405
+ * }
1406
+ * ```
1407
+ *
1408
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1409
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1410
+ */
1411
+ <TData, TVariables extends OperationVariables, Options extends never>(
1412
+ query: {} extends TVariables ? DocumentNode | TypedDocumentNode<TData, TVariables> : never,
1413
+ ): useSuspenseQuery.ResultForOptions<TData, TVariables, Record<string, never>>;
1414
+ /**
1415
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1416
+ *
1417
+ * @example
1418
+ *
1419
+ * ```jsx
1420
+ * import { Suspense } from "octane";
1421
+ * import { useSuspenseQuery } from "@apollo/client";
1422
+ *
1423
+ * const listQuery = gql`
1424
+ * query {
1425
+ * list {
1426
+ * id
1427
+ * }
1428
+ * }
1429
+ * `;
1430
+ *
1431
+ * function App() {
1432
+ * return (
1433
+ * <Suspense fallback={<Spinner />}>
1434
+ * <List />
1435
+ * </Suspense>
1436
+ * );
1437
+ * }
1438
+ *
1439
+ * function List() {
1440
+ * const { data } = useSuspenseQuery(listQuery);
1441
+ *
1442
+ * return (
1443
+ * <ol>
1444
+ * {data.list.map((item) => (
1445
+ * <Item key={item.id} id={item.id} />
1446
+ * ))}
1447
+ * </ol>
1448
+ * );
1449
+ * }
1450
+ * ```
1451
+ *
1452
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1453
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1454
+ */
1455
+ <
1456
+ TData,
1457
+ TVariables extends OperationVariables,
1458
+ TOptions extends useSuspenseQuery.Options<NoInfer<TVariables>> &
1459
+ VariablesOption<
1460
+ TVariables & {
1461
+ [K in Exclude<keyof TOptions['variables'], keyof TVariables>]?: never;
1462
+ }
1463
+ >,
1464
+ >(
1465
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1466
+ ...[options]: {} extends TVariables ? [options?: TOptions] : [options: TOptions]
1467
+ ): useSuspenseQuery.ResultForOptions<TData, TVariables, TOptions>;
1468
+ /**
1469
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1470
+ *
1471
+ * @example
1472
+ *
1473
+ * ```jsx
1474
+ * import { Suspense } from "octane";
1475
+ * import { useSuspenseQuery } from "@apollo/client";
1476
+ *
1477
+ * const listQuery = gql`
1478
+ * query {
1479
+ * list {
1480
+ * id
1481
+ * }
1482
+ * }
1483
+ * `;
1484
+ *
1485
+ * function App() {
1486
+ * return (
1487
+ * <Suspense fallback={<Spinner />}>
1488
+ * <List />
1489
+ * </Suspense>
1490
+ * );
1491
+ * }
1492
+ *
1493
+ * function List() {
1494
+ * const { data } = useSuspenseQuery(listQuery);
1495
+ *
1496
+ * return (
1497
+ * <ol>
1498
+ * {data.list.map((item) => (
1499
+ * <Item key={item.id} id={item.id} />
1500
+ * ))}
1501
+ * </ol>
1502
+ * );
1503
+ * }
1504
+ * ```
1505
+ *
1506
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1507
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1508
+ */
1509
+ <TData, TVariables extends OperationVariables, TOptions extends never>(
1510
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1511
+ skipToken: SkipToken,
1512
+ ): useSuspenseQuery.ResultForOptions<TData, TVariables, SkipToken>;
1513
+ /**
1514
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1515
+ *
1516
+ * @example
1517
+ *
1518
+ * ```jsx
1519
+ * import { Suspense } from "octane";
1520
+ * import { useSuspenseQuery } from "@apollo/client";
1521
+ *
1522
+ * const listQuery = gql`
1523
+ * query {
1524
+ * list {
1525
+ * id
1526
+ * }
1527
+ * }
1528
+ * `;
1529
+ *
1530
+ * function App() {
1531
+ * return (
1532
+ * <Suspense fallback={<Spinner />}>
1533
+ * <List />
1534
+ * </Suspense>
1535
+ * );
1536
+ * }
1537
+ *
1538
+ * function List() {
1539
+ * const { data } = useSuspenseQuery(listQuery);
1540
+ *
1541
+ * return (
1542
+ * <ol>
1543
+ * {data.list.map((item) => (
1544
+ * <Item key={item.id} id={item.id} />
1545
+ * ))}
1546
+ * </ol>
1547
+ * );
1548
+ * }
1549
+ * ```
1550
+ *
1551
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1552
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1553
+ */
1554
+ <
1555
+ TData,
1556
+ TVariables extends OperationVariables,
1557
+ TOptions extends useSuspenseQuery.Options<NoInfer<TVariables>> &
1558
+ VariablesOption<
1559
+ TVariables & {
1560
+ [K in Exclude<keyof TOptions['variables'], keyof TVariables>]?: never;
1561
+ }
1562
+ >,
1563
+ >(
1564
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1565
+ ...[options]: {} extends TVariables
1566
+ ? [options?: TOptions | SkipToken]
1567
+ : [options: TOptions | SkipToken]
1568
+ ): useSuspenseQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
1569
+ }
1570
+ type Evaluated = SignatureStyle extends 'classic' ? Classic : Modern;
1571
+ }
1572
+ /**
1573
+ * For a detailed explanation of `useSuspenseQuery`, see the [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
1574
+ *
1575
+ * @example
1576
+ *
1577
+ * ```jsx
1578
+ * import { Suspense } from "octane";
1579
+ * import { useSuspenseQuery } from "@apollo/client";
1580
+ *
1581
+ * const listQuery = gql`
1582
+ * query {
1583
+ * list {
1584
+ * id
1585
+ * }
1586
+ * }
1587
+ * `;
1588
+ *
1589
+ * function App() {
1590
+ * return (
1591
+ * <Suspense fallback={<Spinner />}>
1592
+ * <List />
1593
+ * </Suspense>
1594
+ * );
1595
+ * }
1596
+ *
1597
+ * function List() {
1598
+ * const { data } = useSuspenseQuery(listQuery);
1599
+ *
1600
+ * return (
1601
+ * <ol>
1602
+ * {data.list.map((item) => (
1603
+ * <Item key={item.id} id={item.id} />
1604
+ * ))}
1605
+ * </ol>
1606
+ * );
1607
+ * }
1608
+ * ```
1609
+ *
1610
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1611
+ * @param options - An optional object containing options for the query. Instead of passing a `useSuspenseQuery.Options` object into the hook, you can also pass a [`skipToken`](#skiptoken) to prevent the `useSuspenseQuery` hook from executing the query or suspending.
1612
+ */
1613
+ interface Signature extends Signatures.Evaluated {}
1614
+ }
1615
+ export declare const useSuspenseQuery: useSuspenseQuery.Signature;
1616
+ interface UseWatchQueryOptionsHookOptions<TData, TVariables extends OperationVariables> {
1617
+ client: ApolloClient;
1618
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>;
1619
+ options: SkipToken | useSuspenseQuery.Options<TVariables>;
1620
+ }
1621
+ export declare function useWatchQueryOptions<TData, TVariables extends OperationVariables>({
1622
+ client,
1623
+ query,
1624
+ options,
1625
+ }: UseWatchQueryOptionsHookOptions<TData, TVariables>): ApolloClient.WatchQueryOptions<
1626
+ TData,
1627
+ TVariables
1628
+ >;
1629
+ export {};