@apollo/client 4.0.0-rc.4 → 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.
Files changed (119) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/__cjs/cache/core/cache.cjs +2 -6
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +42 -13
  5. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  6. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  7. package/__cjs/cache/inmemory/entityStore.d.cts +1 -1
  8. package/__cjs/cache/inmemory/inMemoryCache.cjs +1 -1
  9. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  10. package/__cjs/cache/inmemory/types.d.cts +1 -1
  11. package/__cjs/core/ApolloClient.cjs +45 -7
  12. package/__cjs/core/ApolloClient.cjs.map +1 -1
  13. package/__cjs/core/ApolloClient.d.cts +17 -4
  14. package/__cjs/core/ObservableQuery.cjs +40 -10
  15. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  16. package/__cjs/core/ObservableQuery.d.cts +73 -9
  17. package/__cjs/core/types.d.cts +87 -10
  18. package/__cjs/link/http/HttpLink.cjs.map +1 -1
  19. package/__cjs/link/http/HttpLink.d.cts +11 -1
  20. package/__cjs/react/hooks/useBackgroundQuery.d.cts +4 -0
  21. package/__cjs/react/hooks/useFragment.cjs +4 -9
  22. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  23. package/__cjs/react/hooks/useLazyQuery.d.cts +5 -1
  24. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  25. package/__cjs/react/hooks/useLoadableQuery.d.cts +209 -10
  26. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  27. package/__cjs/react/hooks/useQuery.d.cts +270 -246
  28. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +4 -0
  29. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  30. package/__cjs/react/hooks/useSubscription.d.cts +79 -62
  31. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  32. package/__cjs/react/hooks/useSuspenseQuery.d.cts +185 -161
  33. package/__cjs/react/index.cjs +1 -3
  34. package/__cjs/react/index.cjs.map +1 -1
  35. package/__cjs/react/index.d.cts +0 -1
  36. package/__cjs/react/internal/cache/FragmentReference.cjs +1 -1
  37. package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
  38. package/__cjs/react/types/types.documentation.d.cts +12 -1
  39. package/__cjs/utilities/internal/getStoreKeyName.cjs +8 -5
  40. package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
  41. package/__cjs/utilities/internal/index.cjs +4 -2
  42. package/__cjs/utilities/internal/index.cjs.map +1 -1
  43. package/__cjs/utilities/internal/index.d.cts +2 -0
  44. package/__cjs/utilities/internal/removeFragmentSpreads.cjs +14 -0
  45. package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -0
  46. package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +3 -0
  47. package/__cjs/utilities/internal/types/DocumentationTypes.cjs +3 -0
  48. package/__cjs/utilities/internal/types/DocumentationTypes.cjs.map +1 -0
  49. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +82 -0
  50. package/__cjs/version.cjs +1 -1
  51. package/cache/core/cache.d.ts +42 -13
  52. package/cache/core/cache.js +2 -6
  53. package/cache/core/cache.js.map +1 -1
  54. package/cache/inmemory/entityStore.d.ts +1 -1
  55. package/cache/inmemory/entityStore.js +3 -3
  56. package/cache/inmemory/entityStore.js.map +1 -1
  57. package/cache/inmemory/inMemoryCache.js +1 -1
  58. package/cache/inmemory/inMemoryCache.js.map +1 -1
  59. package/cache/inmemory/types.d.ts +1 -1
  60. package/cache/inmemory/types.js.map +1 -1
  61. package/core/ApolloClient.d.ts +17 -4
  62. package/core/ApolloClient.js +46 -8
  63. package/core/ApolloClient.js.map +1 -1
  64. package/core/ObservableQuery.d.ts +73 -9
  65. package/core/ObservableQuery.js +40 -10
  66. package/core/ObservableQuery.js.map +1 -1
  67. package/core/types.d.ts +87 -10
  68. package/core/types.js.map +1 -1
  69. package/link/http/HttpLink.d.ts +11 -1
  70. package/link/http/HttpLink.js.map +1 -1
  71. package/package.json +1 -1
  72. package/react/hooks/useBackgroundQuery.d.ts +4 -0
  73. package/react/hooks/useFragment.js +4 -9
  74. package/react/hooks/useFragment.js.map +1 -1
  75. package/react/hooks/useLazyQuery.d.ts +5 -1
  76. package/react/hooks/useLoadableQuery.d.ts +209 -10
  77. package/react/hooks/useLoadableQuery.js.map +1 -1
  78. package/react/hooks/useQuery.d.ts +270 -246
  79. package/react/hooks/useQuery.js.map +1 -1
  80. package/react/hooks/useQueryRefHandlers.d.ts +4 -0
  81. package/react/hooks/useSubscription.d.ts +79 -62
  82. package/react/hooks/useSubscription.js.map +1 -1
  83. package/react/hooks/useSuspenseQuery.d.ts +185 -161
  84. package/react/hooks/useSuspenseQuery.js.map +1 -1
  85. package/react/hooks-compiled/useBackgroundQuery.d.ts +4 -0
  86. package/react/hooks-compiled/useFragment.js +4 -9
  87. package/react/hooks-compiled/useFragment.js.map +1 -1
  88. package/react/hooks-compiled/useLazyQuery.d.ts +5 -1
  89. package/react/hooks-compiled/useLoadableQuery.d.ts +209 -10
  90. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  91. package/react/hooks-compiled/useQuery.d.ts +270 -246
  92. package/react/hooks-compiled/useQuery.js.map +1 -1
  93. package/react/hooks-compiled/useQueryRefHandlers.d.ts +4 -0
  94. package/react/hooks-compiled/useSubscription.d.ts +79 -62
  95. package/react/hooks-compiled/useSubscription.js.map +1 -1
  96. package/react/hooks-compiled/useSuspenseQuery.d.ts +185 -161
  97. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  98. package/react/index.compiled.d.ts +0 -1
  99. package/react/index.compiled.js +0 -1
  100. package/react/index.compiled.js.map +1 -1
  101. package/react/index.d.ts +0 -1
  102. package/react/index.js +0 -1
  103. package/react/index.js.map +1 -1
  104. package/react/internal/cache/FragmentReference.js +1 -1
  105. package/react/internal/cache/FragmentReference.js.map +1 -1
  106. package/react/types/types.documentation.d.ts +12 -1
  107. package/react/types/types.documentation.js.map +1 -1
  108. package/utilities/internal/getStoreKeyName.js +8 -5
  109. package/utilities/internal/getStoreKeyName.js.map +1 -1
  110. package/utilities/internal/index.d.ts +2 -0
  111. package/utilities/internal/index.js +1 -0
  112. package/utilities/internal/index.js.map +1 -1
  113. package/utilities/internal/removeFragmentSpreads.d.ts +3 -0
  114. package/utilities/internal/removeFragmentSpreads.js +11 -0
  115. package/utilities/internal/removeFragmentSpreads.js.map +1 -0
  116. package/utilities/internal/types/DocumentationTypes.d.ts +82 -0
  117. package/utilities/internal/types/DocumentationTypes.js +2 -0
  118. package/utilities/internal/types/DocumentationTypes.js.map +1 -0
  119. package/version.js +1 -1
@@ -180,7 +180,7 @@ export declare namespace useLazyQuery {
180
180
  */
181
181
  previousData?: MaybeMasked<TData>;
182
182
  /**
183
- * If the query produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
183
+ * A single ErrorLike object describing the error that occured during the latest query execution.
184
184
  *
185
185
  * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
186
186
  *
@@ -249,6 +249,10 @@ export declare namespace useLazyQuery {
249
249
  data: undefined;
250
250
  /**
251
251
  * Describes the completeness of `data`. - `empty`: No data could be fulfilled from the cache or the result is incomplete. `data` is `undefined`. - `partial`: Some data could be fulfilled from the cache but `data` is incomplete. This is only possible when `returnPartialData` is `true`. - `streaming`: `data` is incomplete as a result of a deferred query and the result is still streaming in. - `complete`: `data` is a fully satisfied query result fulfilled either from the cache or network.
252
+ *
253
+ * @docGroup
254
+ *
255
+ * 1. Operation data
252
256
  */
253
257
  dataState: "empty";
254
258
  });
@@ -114,17 +114,59 @@ export declare namespace useLoadableQuery {
114
114
  */
115
115
  returnPartialData?: boolean;
116
116
  }
117
+ namespace DocumentationTypes {
118
+ /**
119
+ * A hook for imperatively loading a query, such as responding to a user interaction.
120
+ *
121
+ * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.
122
+ *
123
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
124
+ *
125
+ * @param options - Options to control how the query is executed.
126
+ *
127
+ * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`
128
+ *
129
+ * @example
130
+ * ```jsx
131
+ * import { gql, useLoadableQuery } from "@apollo/client";
132
+ *
133
+ * const GET_GREETING = gql`
134
+ * query GetGreeting($language: String!) {
135
+ * greeting(language: $language) {
136
+ * message
137
+ * }
138
+ * }
139
+ * `;
140
+ *
141
+ * function App() {
142
+ * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);
143
+ *
144
+ * return (
145
+ * <>
146
+ * <button onClick={() => loadGreeting({ language: "english" })}>
147
+ * Load greeting
148
+ * </button>
149
+ * <Suspense fallback={<div>Loading...</div>}>
150
+ * {queryRef && <Hello queryRef={queryRef} />}
151
+ * </Suspense>
152
+ * </>
153
+ * );
154
+ * }
155
+ *
156
+ * function Hello({ queryRef }) {
157
+ * const { data } = useReadQuery(queryRef);
158
+ *
159
+ * return <div>{data.greeting.message}</div>;
160
+ * }
161
+ * ```
162
+ *
163
+ * @since
164
+ *
165
+ * 3.9.0
166
+ */
167
+ function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options): useLoadableQuery.Result<TData, TVariables>;
168
+ }
117
169
  }
118
- export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
119
- returnPartialData: true;
120
- errorPolicy: "ignore" | "all";
121
- }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "partial" | "empty">;
122
- export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
123
- errorPolicy: "ignore" | "all";
124
- }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "empty">;
125
- export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
126
- returnPartialData: true;
127
- }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "partial">;
128
170
  /**
129
171
  * A hook for imperatively loading a query, such as responding to a user
130
172
  * interaction.
@@ -170,6 +212,163 @@ export declare function useLoadableQuery<TData = unknown, TVariables extends Ope
170
212
  * @param options - Options to control how the query is executed.
171
213
  * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`
172
214
  */
215
+ export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
216
+ returnPartialData: true;
217
+ errorPolicy: "ignore" | "all";
218
+ }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "partial" | "empty">;
219
+ /**
220
+ * A hook for imperatively loading a query, such as responding to a user interaction.
221
+ *
222
+ * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.
223
+ *
224
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
225
+ *
226
+ * @param options - Options to control how the query is executed.
227
+ *
228
+ * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`
229
+ *
230
+ * @example
231
+ * ```jsx
232
+ * import { gql, useLoadableQuery } from "@apollo/client";
233
+ *
234
+ * const GET_GREETING = gql`
235
+ * query GetGreeting($language: String!) {
236
+ * greeting(language: $language) {
237
+ * message
238
+ * }
239
+ * }
240
+ * `;
241
+ *
242
+ * function App() {
243
+ * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);
244
+ *
245
+ * return (
246
+ * <>
247
+ * <button onClick={() => loadGreeting({ language: "english" })}>
248
+ * Load greeting
249
+ * </button>
250
+ * <Suspense fallback={<div>Loading...</div>}>
251
+ * {queryRef && <Hello queryRef={queryRef} />}
252
+ * </Suspense>
253
+ * </>
254
+ * );
255
+ * }
256
+ *
257
+ * function Hello({ queryRef }) {
258
+ * const { data } = useReadQuery(queryRef);
259
+ *
260
+ * return <div>{data.greeting.message}</div>;
261
+ * }
262
+ * ```
263
+ *
264
+ * @since
265
+ *
266
+ * 3.9.0
267
+ */
268
+ export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
269
+ errorPolicy: "ignore" | "all";
270
+ }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "empty">;
271
+ /**
272
+ * A hook for imperatively loading a query, such as responding to a user interaction.
273
+ *
274
+ * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.
275
+ *
276
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
277
+ *
278
+ * @param options - Options to control how the query is executed.
279
+ *
280
+ * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`
281
+ *
282
+ * @example
283
+ * ```jsx
284
+ * import { gql, useLoadableQuery } from "@apollo/client";
285
+ *
286
+ * const GET_GREETING = gql`
287
+ * query GetGreeting($language: String!) {
288
+ * greeting(language: $language) {
289
+ * message
290
+ * }
291
+ * }
292
+ * `;
293
+ *
294
+ * function App() {
295
+ * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);
296
+ *
297
+ * return (
298
+ * <>
299
+ * <button onClick={() => loadGreeting({ language: "english" })}>
300
+ * Load greeting
301
+ * </button>
302
+ * <Suspense fallback={<div>Loading...</div>}>
303
+ * {queryRef && <Hello queryRef={queryRef} />}
304
+ * </Suspense>
305
+ * </>
306
+ * );
307
+ * }
308
+ *
309
+ * function Hello({ queryRef }) {
310
+ * const { data } = useReadQuery(queryRef);
311
+ *
312
+ * return <div>{data.greeting.message}</div>;
313
+ * }
314
+ * ```
315
+ *
316
+ * @since
317
+ *
318
+ * 3.9.0
319
+ */
320
+ export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useLoadableQuery.Options & {
321
+ returnPartialData: true;
322
+ }): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming" | "partial">;
323
+ /**
324
+ * A hook for imperatively loading a query, such as responding to a user interaction.
325
+ *
326
+ * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.
327
+ *
328
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
329
+ *
330
+ * @param options - Options to control how the query is executed.
331
+ *
332
+ * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`
333
+ *
334
+ * @example
335
+ * ```jsx
336
+ * import { gql, useLoadableQuery } from "@apollo/client";
337
+ *
338
+ * const GET_GREETING = gql`
339
+ * query GetGreeting($language: String!) {
340
+ * greeting(language: $language) {
341
+ * message
342
+ * }
343
+ * }
344
+ * `;
345
+ *
346
+ * function App() {
347
+ * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);
348
+ *
349
+ * return (
350
+ * <>
351
+ * <button onClick={() => loadGreeting({ language: "english" })}>
352
+ * Load greeting
353
+ * </button>
354
+ * <Suspense fallback={<div>Loading...</div>}>
355
+ * {queryRef && <Hello queryRef={queryRef} />}
356
+ * </Suspense>
357
+ * </>
358
+ * );
359
+ * }
360
+ *
361
+ * function Hello({ queryRef }) {
362
+ * const { data } = useReadQuery(queryRef);
363
+ *
364
+ * return <div>{data.greeting.message}</div>;
365
+ * }
366
+ * ```
367
+ *
368
+ * @since
369
+ *
370
+ * 3.9.0
371
+ */
173
372
  export declare function useLoadableQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useLoadableQuery.Options): useLoadableQuery.Result<TData, TVariables, "complete" | "streaming">;
174
373
  export {};
175
374
  //# sourceMappingURL=useLoadableQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLoadableQuery.js","sources":["../../../src/react/hooks/useLoadableQuery.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n ApolloClient,\n DataState,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"@apollo/client\";\nimport type {\n SubscribeToMoreFunction,\n SubscribeToMoreOptions,\n} from \"@apollo/client\";\nimport { canonicalStringify } from \"@apollo/client/cache\";\nimport type {\n CacheKey,\n FetchMoreFunction,\n QueryRef,\n RefetchFunction,\n} from \"@apollo/client/react/internal\";\nimport {\n assertWrappedQueryRef,\n getSuspenseCache,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { __use, useDeepMemo, useRenderGuard } from \"./internal/index.js\";\nimport { validateSuspenseHookOptions } from \"./internal/validateSuspenseHookOptions.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\ntype ResetFunction = () => void;\n\nexport declare namespace useLoadableQuery {\n export type LoadQueryFunction<TVariables extends OperationVariables> = (\n // Use variadic args to handle cases where TVariables is type `never`, in\n // which case we don't want to allow a variables argument. In other\n // words, we don't want to allow variables to be passed as an argument to this\n // function if the query does not expect variables in the document.\n ...args: {} extends TVariables ? [variables?: TVariables]\n : [variables: TVariables]\n ) => void;\n\n export type Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TStates extends\n DataState<TData>[\"dataState\"] = DataState<TData>[\"dataState\"],\n > = [\n loadQuery: LoadQueryFunction<TVariables>,\n queryRef: QueryRef<TData, TVariables, TStates> | null,\n handlers: {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: FetchMoreFunction<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: RefetchFunction<TData, TVariables>;\n /** {@inheritDoc @apollo/client!ObservableQuery#subscribeToMore:member(1)} */\n subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;\n /**\n * A function that resets the `queryRef` back to `null`.\n */\n reset: ResetFunction;\n },\n ];\n\n export type FetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n >;\n\n export interface Options {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n }\n}\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n>;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n errorPolicy: \"ignore\" | \"all\";\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n>;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n returnPartialData: true;\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n>;\n\n/**\n * A hook for imperatively loading a query, such as responding to a user\n * interaction.\n *\n * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLoadableQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function App() {\n * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);\n *\n * return (\n * <>\n * <button onClick={() => loadGreeting({ language: \"english\" })}>\n * Load greeting\n * </button>\n * <Suspense fallback={<div>Loading...</div>}>\n * {queryRef && <Hello queryRef={queryRef} />}\n * </Suspense>\n * </>\n * );\n * }\n *\n * function Hello({ queryRef }) {\n * const { data } = useReadQuery(queryRef);\n *\n * return <div>{data.greeting.message}</div>;\n * }\n * ```\n *\n * @since 3.9.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`\n */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: useLoadableQuery.Options\n): useLoadableQuery.Result<TData, TVariables, \"complete\" | \"streaming\">;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options = {}\n): useLoadableQuery.Result<TData, TVariables> {\n const client = useApolloClient(options.client);\n const suspenseCache = getSuspenseCache(client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { queryKey = [] } = options;\n\n const [queryRef, setQueryRef] = React.useState<QueryRef<\n TData,\n TVariables,\n DataState<TData>[\"dataState\"]\n > | null>(null);\n\n assertWrappedQueryRef(queryRef);\n\n const internalQueryRef = queryRef && unwrapQueryRef(queryRef);\n\n if (queryRef && internalQueryRef?.didChangeOptions(watchQueryOptions)) {\n const promise = internalQueryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(queryRef, promise);\n }\n\n const calledDuringRender = useRenderGuard();\n\n const fetchMore: FetchMoreFunction<TData, TVariables> = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.fetchMore(options);\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const refetch: RefetchFunction<TData, TVariables> = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.refetch(options);\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const loadQuery: useLoadableQuery.LoadQueryFunction<TVariables> =\n React.useCallback(\n (...args) => {\n invariant(\n !calledDuringRender(),\n \"useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook.\"\n );\n\n const [variables] = args;\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery({\n ...watchQueryOptions,\n variables,\n } as WatchQueryOptions<any, any>)\n );\n\n setQueryRef(wrapQueryRef(queryRef));\n },\n [\n query,\n queryKey,\n suspenseCache,\n watchQueryOptions,\n calledDuringRender,\n client,\n ]\n );\n\n const subscribeToMore: SubscribeToMoreFunction<TData, TVariables> =\n React.useCallback(\n (options) => {\n invariant(\n internalQueryRef,\n \"The query has not been loaded. Please load the query.\"\n );\n\n return internalQueryRef.observable.subscribeToMore(\n // TODO: The internalQueryRef doesn't have TVariables' type information so we have to cast it here\n options as any as SubscribeToMoreOptions<TData, OperationVariables>\n );\n },\n [internalQueryRef]\n );\n\n const reset: ResetFunction = React.useCallback(() => {\n setQueryRef(null);\n }, []);\n\n return [loadQuery, queryRef, { fetchMore, refetch, reset, subscribeToMore }];\n}\n\nfunction useWatchQueryOptions<TData, TVariables extends OperationVariables>({\n client,\n query,\n options,\n}: {\n client: ApolloClient;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n options: useLoadableQuery.Options;\n}): WatchQueryOptions<TVariables, TData> {\n return useDeepMemo<WatchQueryOptions<TVariables, TData>>(() => {\n const fetchPolicy =\n options.fetchPolicy ||\n client.defaultOptions.watchQuery?.fetchPolicy ||\n \"cache-first\";\n\n const watchQueryOptions = {\n ...options,\n fetchPolicy,\n query,\n notifyOnNetworkStatusChange: false,\n nextFetchPolicy: void 0,\n };\n\n if (__DEV__) {\n validateSuspenseHookOptions(watchQueryOptions as any);\n }\n\n return watchQueryOptions as WatchQueryOptions<TVariables, TData>;\n }, [client, options, query]);\n}\n"],"names":[],"mappings":";AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAkB9B,CAAA,CAAA,CAAA,CAAA,CAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuF;AACvF,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAgC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD"}
1
+ {"version":3,"file":"useLoadableQuery.js","sources":["../../../src/react/hooks/useLoadableQuery.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n ApolloClient,\n DataState,\n DefaultContext,\n DocumentNode,\n ErrorPolicy,\n OperationVariables,\n RefetchWritePolicy,\n TypedDocumentNode,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"@apollo/client\";\nimport type {\n SubscribeToMoreFunction,\n SubscribeToMoreOptions,\n} from \"@apollo/client\";\nimport { canonicalStringify } from \"@apollo/client/cache\";\nimport type {\n CacheKey,\n FetchMoreFunction,\n QueryRef,\n RefetchFunction,\n} from \"@apollo/client/react/internal\";\nimport {\n assertWrappedQueryRef,\n getSuspenseCache,\n unwrapQueryRef,\n updateWrappedQueryRef,\n wrapQueryRef,\n} from \"@apollo/client/react/internal\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { __use, useDeepMemo, useRenderGuard } from \"./internal/index.js\";\nimport { validateSuspenseHookOptions } from \"./internal/validateSuspenseHookOptions.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\n\ntype ResetFunction = () => void;\n\nexport declare namespace useLoadableQuery {\n export type LoadQueryFunction<TVariables extends OperationVariables> = (\n // Use variadic args to handle cases where TVariables is type `never`, in\n // which case we don't want to allow a variables argument. In other\n // words, we don't want to allow variables to be passed as an argument to this\n // function if the query does not expect variables in the document.\n ...args: {} extends TVariables ? [variables?: TVariables]\n : [variables: TVariables]\n ) => void;\n\n export type Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TStates extends\n DataState<TData>[\"dataState\"] = DataState<TData>[\"dataState\"],\n > = [\n loadQuery: LoadQueryFunction<TVariables>,\n queryRef: QueryRef<TData, TVariables, TStates> | null,\n handlers: {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: FetchMoreFunction<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: RefetchFunction<TData, TVariables>;\n /** {@inheritDoc @apollo/client!ObservableQuery#subscribeToMore:member(1)} */\n subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;\n /**\n * A function that resets the `queryRef` back to `null`.\n */\n reset: ResetFunction;\n },\n ];\n\n export type FetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n >;\n\n export interface Options {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */\n client?: ApolloClient;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#queryKey:member} */\n queryKey?: string | number | any[];\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n }\n\n export namespace DocumentationTypes {\n /** {@inheritDoc @apollo/client!useLoadableQuery:function(1)} */\n export function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options\n ): useLoadableQuery.Result<TData, TVariables>;\n }\n}\n\n/**\n * A hook for imperatively loading a query, such as responding to a user\n * interaction.\n *\n * > Refer to the [Suspense - Fetching in response to user interaction](https://www.apollographql.com/docs/react/data/suspense#fetching-in-response-to-user-interaction) section for a more in-depth overview of `useLoadableQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useLoadableQuery } from \"@apollo/client\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function App() {\n * const [loadGreeting, queryRef] = useLoadableQuery(GET_GREETING);\n *\n * return (\n * <>\n * <button onClick={() => loadGreeting({ language: \"english\" })}>\n * Load greeting\n * </button>\n * <Suspense fallback={<div>Loading...</div>}>\n * {queryRef && <Hello queryRef={queryRef} />}\n * </Suspense>\n * </>\n * );\n * }\n *\n * function Hello({ queryRef }) {\n * const { data } = useReadQuery(queryRef);\n *\n * return <div>{data.greeting.message}</div>;\n * }\n * ```\n *\n * @since 3.9.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns A tuple in the form of `[loadQuery, queryRef, handlers]`\n */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n returnPartialData: true;\n errorPolicy: \"ignore\" | \"all\";\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\" | \"empty\"\n>;\n\n/** {@inheritDoc @apollo/client!useLoadableQuery:function(1)} */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n errorPolicy: \"ignore\" | \"all\";\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"empty\"\n>;\n\n/** {@inheritDoc @apollo/client!useLoadableQuery:function(1)} */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options & {\n returnPartialData: true;\n }\n): useLoadableQuery.Result<\n TData,\n TVariables,\n \"complete\" | \"streaming\" | \"partial\"\n>;\n\n/** {@inheritDoc @apollo/client!useLoadableQuery:function(1)} */\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options?: useLoadableQuery.Options\n): useLoadableQuery.Result<TData, TVariables, \"complete\" | \"streaming\">;\n\nexport function useLoadableQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useLoadableQuery.Options = {}\n): useLoadableQuery.Result<TData, TVariables> {\n const client = useApolloClient(options.client);\n const suspenseCache = getSuspenseCache(client);\n const watchQueryOptions = useWatchQueryOptions({ client, query, options });\n const { queryKey = [] } = options;\n\n const [queryRef, setQueryRef] = React.useState<QueryRef<\n TData,\n TVariables,\n DataState<TData>[\"dataState\"]\n > | null>(null);\n\n assertWrappedQueryRef(queryRef);\n\n const internalQueryRef = queryRef && unwrapQueryRef(queryRef);\n\n if (queryRef && internalQueryRef?.didChangeOptions(watchQueryOptions)) {\n const promise = internalQueryRef.applyOptions(watchQueryOptions);\n updateWrappedQueryRef(queryRef, promise);\n }\n\n const calledDuringRender = useRenderGuard();\n\n const fetchMore: FetchMoreFunction<TData, TVariables> = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.fetchMore(options);\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const refetch: RefetchFunction<TData, TVariables> = React.useCallback(\n (options) => {\n if (!internalQueryRef) {\n throw new Error(\n \"The query has not been loaded. Please load the query.\"\n );\n }\n\n const promise = internalQueryRef.refetch(options);\n\n setQueryRef(wrapQueryRef(internalQueryRef));\n\n return promise;\n },\n [internalQueryRef]\n );\n\n const loadQuery: useLoadableQuery.LoadQueryFunction<TVariables> =\n React.useCallback(\n (...args) => {\n invariant(\n !calledDuringRender(),\n \"useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook.\"\n );\n\n const [variables] = args;\n\n const cacheKey: CacheKey = [\n query,\n canonicalStringify(variables),\n ...([] as any[]).concat(queryKey),\n ];\n\n const queryRef = suspenseCache.getQueryRef(cacheKey, () =>\n client.watchQuery({\n ...watchQueryOptions,\n variables,\n } as WatchQueryOptions<any, any>)\n );\n\n setQueryRef(wrapQueryRef(queryRef));\n },\n [\n query,\n queryKey,\n suspenseCache,\n watchQueryOptions,\n calledDuringRender,\n client,\n ]\n );\n\n const subscribeToMore: SubscribeToMoreFunction<TData, TVariables> =\n React.useCallback(\n (options) => {\n invariant(\n internalQueryRef,\n \"The query has not been loaded. Please load the query.\"\n );\n\n return internalQueryRef.observable.subscribeToMore(\n // TODO: The internalQueryRef doesn't have TVariables' type information so we have to cast it here\n options as any as SubscribeToMoreOptions<TData, OperationVariables>\n );\n },\n [internalQueryRef]\n );\n\n const reset: ResetFunction = React.useCallback(() => {\n setQueryRef(null);\n }, []);\n\n return [loadQuery, queryRef, { fetchMore, refetch, reset, subscribeToMore }];\n}\n\nfunction useWatchQueryOptions<TData, TVariables extends OperationVariables>({\n client,\n query,\n options,\n}: {\n client: ApolloClient;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n options: useLoadableQuery.Options;\n}): WatchQueryOptions<TVariables, TData> {\n return useDeepMemo<WatchQueryOptions<TVariables, TData>>(() => {\n const fetchPolicy =\n options.fetchPolicy ||\n client.defaultOptions.watchQuery?.fetchPolicy ||\n \"cache-first\";\n\n const watchQueryOptions = {\n ...options,\n fetchPolicy,\n query,\n notifyOnNetworkStatusChange: false,\n nextFetchPolicy: void 0,\n };\n\n if (__DEV__) {\n validateSuspenseHookOptions(watchQueryOptions as any);\n }\n\n return watchQueryOptions as WatchQueryOptions<TVariables, TData>;\n }, [client, options, query]);\n}\n"],"names":[],"mappings":";AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAkB9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAmC,CAAnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyD;AAOzD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EACL,CADF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACuB,EACrB,CAFF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAEkB,EAChB,CAHF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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