@apollo/client 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/__cjs/core/ApolloClient.cjs.map +1 -1
  3. package/__cjs/core/ApolloClient.d.cts +29 -2
  4. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  5. package/__cjs/react/hooks/useBackgroundQuery.d.cts +1023 -23
  6. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  7. package/__cjs/react/hooks/useLazyQuery.d.cts +115 -7
  8. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  9. package/__cjs/react/hooks/useLoadableQuery.d.cts +195 -8
  10. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  11. package/__cjs/react/hooks/useMutation.d.cts +20 -9
  12. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  13. package/__cjs/react/hooks/useQuery.d.cts +288 -19
  14. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  15. package/__cjs/react/hooks/useSuspenseQuery.d.cts +409 -17
  16. package/__cjs/version.cjs +1 -1
  17. package/core/ApolloClient.d.ts +29 -2
  18. package/core/ApolloClient.js.map +1 -1
  19. package/package.json +1 -1
  20. package/react/hooks/useBackgroundQuery.d.ts +1023 -23
  21. package/react/hooks/useBackgroundQuery.js.map +1 -1
  22. package/react/hooks/useLazyQuery.d.ts +115 -7
  23. package/react/hooks/useLazyQuery.js.map +1 -1
  24. package/react/hooks/useLoadableQuery.d.ts +195 -8
  25. package/react/hooks/useLoadableQuery.js.map +1 -1
  26. package/react/hooks/useMutation.d.ts +20 -9
  27. package/react/hooks/useMutation.js.map +1 -1
  28. package/react/hooks/useQuery.d.ts +288 -19
  29. package/react/hooks/useQuery.js.map +1 -1
  30. package/react/hooks/useSuspenseQuery.d.ts +409 -17
  31. package/react/hooks/useSuspenseQuery.js.map +1 -1
  32. package/react/hooks-compiled/useBackgroundQuery.d.ts +1023 -23
  33. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  34. package/react/hooks-compiled/useLazyQuery.d.ts +115 -7
  35. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  36. package/react/hooks-compiled/useLoadableQuery.d.ts +195 -8
  37. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  38. package/react/hooks-compiled/useMutation.d.ts +20 -9
  39. package/react/hooks-compiled/useMutation.js.map +1 -1
  40. package/react/hooks-compiled/useQuery.d.ts +288 -19
  41. package/react/hooks-compiled/useQuery.js.map +1 -1
  42. package/react/hooks-compiled/useSuspenseQuery.d.ts +409 -17
  43. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  44. package/version.js +1 -1
@@ -341,10 +341,6 @@ export declare namespace useQuery {
341
341
  }
342
342
  namespace Signatures {
343
343
  /**
344
- * @deprecated Avoid manually specifying generics on `useQuery`.
345
- * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
346
- *
347
- *
348
344
  * A hook for executing queries in an Apollo application.
349
345
  *
350
346
  * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
@@ -381,6 +377,279 @@ export declare namespace useQuery {
381
377
  * @returns Query result object
382
378
  */
383
379
  interface Classic {
380
+ /**
381
+ * A hook for executing queries in an Apollo application.
382
+ *
383
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
384
+ *
385
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
386
+ *
387
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
388
+ *
389
+ * @example
390
+ *
391
+ * ```jsx
392
+ * import { gql } from "@apollo/client";
393
+ * import { useQuery } from "@apollo/client/react";
394
+ *
395
+ * const GET_GREETING = gql`
396
+ * query GetGreeting($language: String!) {
397
+ * greeting(language: $language) {
398
+ * message
399
+ * }
400
+ * }
401
+ * `;
402
+ *
403
+ * function Hello() {
404
+ * const { loading, error, data } = useQuery(GET_GREETING, {
405
+ * variables: { language: "english" },
406
+ * });
407
+ * if (loading) return <p>Loading ...</p>;
408
+ * return <h1>Hello {data.greeting.message}!</h1>;
409
+ * }
410
+ * ```
411
+ *
412
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
413
+ * @param options - Options to control how the query is executed.
414
+ * @returns Query result object
415
+ */
416
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
417
+ returnPartialData: true;
418
+ }): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial">;
419
+ /**
420
+ * A hook for executing queries in an Apollo application.
421
+ *
422
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
423
+ *
424
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
425
+ *
426
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
427
+ *
428
+ * @example
429
+ *
430
+ * ```jsx
431
+ * import { gql } from "@apollo/client";
432
+ * import { useQuery } from "@apollo/client/react";
433
+ *
434
+ * const GET_GREETING = gql`
435
+ * query GetGreeting($language: String!) {
436
+ * greeting(language: $language) {
437
+ * message
438
+ * }
439
+ * }
440
+ * `;
441
+ *
442
+ * function Hello() {
443
+ * const { loading, error, data } = useQuery(GET_GREETING, {
444
+ * variables: { language: "english" },
445
+ * });
446
+ * if (loading) return <p>Loading ...</p>;
447
+ * return <h1>Hello {data.greeting.message}!</h1>;
448
+ * }
449
+ * ```
450
+ *
451
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
452
+ * @param options - Options to control how the query is executed.
453
+ * @returns Query result object
454
+ */
455
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): useQuery.Result<TData, TVariables, "empty", Record<string, never>>;
456
+ /**
457
+ * A hook for executing queries in an Apollo application.
458
+ *
459
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
460
+ *
461
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
462
+ *
463
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
464
+ *
465
+ * @example
466
+ *
467
+ * ```jsx
468
+ * import { gql } from "@apollo/client";
469
+ * import { useQuery } from "@apollo/client/react";
470
+ *
471
+ * const GET_GREETING = gql`
472
+ * query GetGreeting($language: String!) {
473
+ * greeting(language: $language) {
474
+ * message
475
+ * }
476
+ * }
477
+ * `;
478
+ *
479
+ * function Hello() {
480
+ * const { loading, error, data } = useQuery(GET_GREETING, {
481
+ * variables: { language: "english" },
482
+ * });
483
+ * if (loading) return <p>Loading ...</p>;
484
+ * return <h1>Hello {data.greeting.message}!</h1>;
485
+ * }
486
+ * ```
487
+ *
488
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
489
+ * @param options - Options to control how the query is executed.
490
+ * @returns Query result object
491
+ */
492
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
493
+ returnPartialData: true;
494
+ })): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial", Partial<TVariables>>;
495
+ /**
496
+ * A hook for executing queries in an Apollo application.
497
+ *
498
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
499
+ *
500
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
501
+ *
502
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
503
+ *
504
+ * @example
505
+ *
506
+ * ```jsx
507
+ * import { gql } from "@apollo/client";
508
+ * import { useQuery } from "@apollo/client/react";
509
+ *
510
+ * const GET_GREETING = gql`
511
+ * query GetGreeting($language: String!) {
512
+ * greeting(language: $language) {
513
+ * message
514
+ * }
515
+ * }
516
+ * `;
517
+ *
518
+ * function Hello() {
519
+ * const { loading, error, data } = useQuery(GET_GREETING, {
520
+ * variables: { language: "english" },
521
+ * });
522
+ * if (loading) return <p>Loading ...</p>;
523
+ * return <h1>Hello {data.greeting.message}!</h1>;
524
+ * }
525
+ * ```
526
+ *
527
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
528
+ * @param options - Options to control how the query is executed.
529
+ * @returns Query result object
530
+ */
531
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
532
+ returnPartialData: boolean;
533
+ }): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial">;
534
+ /**
535
+ * A hook for executing queries in an Apollo application.
536
+ *
537
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
538
+ *
539
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
540
+ *
541
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
542
+ *
543
+ * @example
544
+ *
545
+ * ```jsx
546
+ * import { gql } from "@apollo/client";
547
+ * import { useQuery } from "@apollo/client/react";
548
+ *
549
+ * const GET_GREETING = gql`
550
+ * query GetGreeting($language: String!) {
551
+ * greeting(language: $language) {
552
+ * message
553
+ * }
554
+ * }
555
+ * `;
556
+ *
557
+ * function Hello() {
558
+ * const { loading, error, data } = useQuery(GET_GREETING, {
559
+ * variables: { language: "english" },
560
+ * });
561
+ * if (loading) return <p>Loading ...</p>;
562
+ * return <h1>Hello {data.greeting.message}!</h1>;
563
+ * }
564
+ * ```
565
+ *
566
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
567
+ * @param options - Options to control how the query is executed.
568
+ * @returns Query result object
569
+ */
570
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
571
+ returnPartialData: boolean;
572
+ })): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial", Partial<TVariables>>;
573
+ /**
574
+ * A hook for executing queries in an Apollo application.
575
+ *
576
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
577
+ *
578
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
579
+ *
580
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
581
+ *
582
+ * @example
583
+ *
584
+ * ```jsx
585
+ * import { gql } from "@apollo/client";
586
+ * import { useQuery } from "@apollo/client/react";
587
+ *
588
+ * const GET_GREETING = gql`
589
+ * query GetGreeting($language: String!) {
590
+ * greeting(language: $language) {
591
+ * message
592
+ * }
593
+ * }
594
+ * `;
595
+ *
596
+ * function Hello() {
597
+ * const { loading, error, data } = useQuery(GET_GREETING, {
598
+ * variables: { language: "english" },
599
+ * });
600
+ * if (loading) return <p>Loading ...</p>;
601
+ * return <h1>Hello {data.greeting.message}!</h1>;
602
+ * }
603
+ * ```
604
+ *
605
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
606
+ * @param options - Options to control how the query is executed.
607
+ * @returns Query result object
608
+ */
609
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
610
+ options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
611
+ ] : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming">;
612
+ /**
613
+ * A hook for executing queries in an Apollo application.
614
+ *
615
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
616
+ *
617
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
618
+ *
619
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
620
+ *
621
+ * @example
622
+ *
623
+ * ```jsx
624
+ * import { gql } from "@apollo/client";
625
+ * import { useQuery } from "@apollo/client/react";
626
+ *
627
+ * const GET_GREETING = gql`
628
+ * query GetGreeting($language: String!) {
629
+ * greeting(language: $language) {
630
+ * message
631
+ * }
632
+ * }
633
+ * `;
634
+ *
635
+ * function Hello() {
636
+ * const { loading, error, data } = useQuery(GET_GREETING, {
637
+ * variables: { language: "english" },
638
+ * });
639
+ * if (loading) return <p>Loading ...</p>;
640
+ * return <h1>Hello {data.greeting.message}!</h1>;
641
+ * }
642
+ * ```
643
+ *
644
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
645
+ * @param options - Options to control how the query is executed.
646
+ * @returns Query result object
647
+ */
648
+ <TData, TVariables extends OperationVariables, _INFERENCE_ONLY_DO_NOT_SPECIFY extends "inferred">(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
649
+ options?: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
650
+ ] : [
651
+ options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
652
+ ]): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming", Partial<TVariables>>;
384
653
  /**
385
654
  * @deprecated Avoid manually specifying generics on `useQuery`.
386
655
  * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
@@ -421,7 +690,7 @@ export declare namespace useQuery {
421
690
  * @param options - Options to control how the query is executed.
422
691
  * @returns Query result object
423
692
  */
424
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
693
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
425
694
  returnPartialData: true;
426
695
  }): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial">;
427
696
  /**
@@ -464,7 +733,7 @@ export declare namespace useQuery {
464
733
  * @param options - Options to control how the query is executed.
465
734
  * @returns Query result object
466
735
  */
467
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): useQuery.Result<TData, TVariables, "empty", Record<string, never>>;
736
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): useQuery.Result<TData, TVariables, "empty", Record<string, never>>;
468
737
  /**
469
738
  * @deprecated Avoid manually specifying generics on `useQuery`.
470
739
  * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
@@ -505,7 +774,7 @@ export declare namespace useQuery {
505
774
  * @param options - Options to control how the query is executed.
506
775
  * @returns Query result object
507
776
  */
508
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
777
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
509
778
  returnPartialData: true;
510
779
  })): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial", Partial<TVariables>>;
511
780
  /**
@@ -548,7 +817,7 @@ export declare namespace useQuery {
548
817
  * @param options - Options to control how the query is executed.
549
818
  * @returns Query result object
550
819
  */
551
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
820
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
552
821
  returnPartialData: boolean;
553
822
  }): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial">;
554
823
  /**
@@ -591,7 +860,7 @@ export declare namespace useQuery {
591
860
  * @param options - Options to control how the query is executed.
592
861
  * @returns Query result object
593
862
  */
594
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
863
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
595
864
  returnPartialData: boolean;
596
865
  })): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming" | "partial", Partial<TVariables>>;
597
866
  /**
@@ -634,7 +903,7 @@ export declare namespace useQuery {
634
903
  * @param options - Options to control how the query is executed.
635
904
  * @returns Query result object
636
905
  */
637
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
906
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
638
907
  options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
639
908
  ] : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]): useQuery.Result<TData, TVariables, "empty" | "complete" | "streaming">;
640
909
  /**
@@ -677,7 +946,7 @@ export declare namespace useQuery {
677
946
  * @param options - Options to control how the query is executed.
678
947
  * @returns Query result object
679
948
  */
680
- <TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
949
+ <TData, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
681
950
  options?: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
682
951
  ] : [
683
952
  options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>
@@ -794,7 +1063,13 @@ export declare namespace useQuery {
794
1063
  * @param options - Options to control how the query is executed.
795
1064
  * @returns Query result object
796
1065
  */
797
- <TData, TVariables extends OperationVariables, TOptions extends SkipToken>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): useQuery.Result<TData, TVariables, "empty", Record<string, never>>;
1066
+ <TData, TVariables extends OperationVariables, TOptions extends useQuery.Options<TData, NoInfer<TVariables>> & VariablesOption<TVariables & {
1067
+ [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
1068
+ }>>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: [
1069
+ TVariables
1070
+ ] extends [never] ? [options: never] : {} extends TVariables ? [options?: TOptions] : [
1071
+ options: TOptions
1072
+ ]): useQuery.ResultForOptions<TData, TVariables, TOptions>;
798
1073
  /**
799
1074
  * A hook for executing queries in an Apollo application.
800
1075
  *
@@ -831,13 +1106,7 @@ export declare namespace useQuery {
831
1106
  * @param options - Options to control how the query is executed.
832
1107
  * @returns Query result object
833
1108
  */
834
- <TData, TVariables extends OperationVariables, TOptions extends useQuery.Options<TData, NoInfer<TVariables>> & VariablesOption<TVariables & {
835
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
836
- }>>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: [
837
- TVariables
838
- ] extends [never] ? [options: never] : {} extends TVariables ? [options?: TOptions] : [
839
- options: TOptions
840
- ]): useQuery.ResultForOptions<TData, TVariables, TOptions>;
1109
+ <TData, TVariables extends OperationVariables, TOptions extends SkipToken>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): useQuery.Result<TData, TVariables, "empty", Record<string, never>>;
841
1110
  /**
842
1111
  * A hook for executing queries in an Apollo application.
843
1112
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO;AACP,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAoBhD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAU/C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAgcjE,MAAM,gBAAgB,GAAG,MAAM,EAAE,CAAC;AA4BlC,MAAM,CAAC,MAAM,QAAQ,GAAuB,SAAS,QAAQ,CAI3D,KAA0D,EAC1D,GAAG,CAAC,OAAO,CAMmE;IAE9E,aAAa,CAAC;IACd,OAAO,QAAQ,CACb,UAAU,EACV,SAAS,EACT,eAAe,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,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,UAAU,CAAC,SAAS,CAAC;IAC9C,CAAC;IACD,UAAU,CAAC,gBAAgB,CAAC,GAAG,iBAAiB,CAAC;AACnD,CAAC;AAED,SAAS,eAAe,CACtB,eAA4E,EAC5E,OAAoE;IAEpE,OAAO,CACL,eAAe,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK;QACvC,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC;QACpD,CAAC,eAAe,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW;YAClD,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS;gBAChC,eAAe,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC3C,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,KAAK,CAAQ;IACnB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,aAAa,CAAC,OAAO;IACpC,OAAO,EAAE,IAAI;CACd,CAAsE,CAAC","sourcesContent":["/**\n * Function parameters in this file try to follow a common order for the sake of\n * readability and consistency. The order is as follows:\n *\n * resultData\n * observable\n * client\n * query\n * options\n * watchQueryOptions\n * makeWatchQueryOptions\n */\n/** */\nimport { equal } from \"@wry/equality\";\nimport * as React from \"react\";\nimport { asapScheduler, observeOn } from \"rxjs\";\n\nimport type {\n DataState,\n DefaultContext,\n DocumentNode,\n ErrorLike,\n ErrorPolicy,\n GetDataState,\n InternalTypes,\n ObservableQuery,\n OperationVariables,\n RefetchOn,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n TypedDocumentNode,\n UpdateQueryMapFn,\n WatchQueryFetchPolicy,\n} from \"@apollo/client\";\nimport type { ApolloClient } from \"@apollo/client\";\nimport { NetworkStatus } from \"@apollo/client\";\nimport type { MaybeMasked } from \"@apollo/client/masking\";\nimport type {\n DocumentationTypes as UtilityDocumentationTypes,\n LazyType,\n NoInfer,\n OptionWithFallback,\n SignatureStyle,\n VariablesOption,\n} from \"@apollo/client/utilities/internal\";\nimport {\n maybeDeepFreeze,\n mergeOptions,\n variablesUnknownSymbol,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { SkipToken } from \"./constants.js\";\nimport { skipToken } from \"./constants.js\";\nimport { useDeepMemo, wrapHook } from \"./internal/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n\nexport declare namespace useQuery {\n import _self = useQuery;\n export namespace Base {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#nextFetchPolicy:member} */\n nextFetchPolicy?:\n | WatchQueryFetchPolicy\n | ((\n this: ApolloClient.WatchQueryOptions<TData, TVariables>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: InternalTypes.NextFetchPolicyContext<TData, TVariables>\n ) => WatchQueryFetchPolicy);\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#initialFetchPolicy:member} */\n\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skipPollAttempt:member} */\n skipPollAttempt?: () => boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */\n ssr?: boolean;\n\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#skip:member} */\n skip?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchOn:member} */\n refetchOn?: RefetchOn.Option;\n }\n }\n export type Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > = Base.Options<TData, TVariables> & VariablesOption<TVariables>;\n\n export namespace DocumentationTypes {\n namespace useQuery {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Base.Options<TData, TVariables>,\n UtilityDocumentationTypes.VariableOptions<TVariables> {}\n }\n }\n\n export namespace Base {\n export interface Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TReturnVariables extends OperationVariables = TVariables,\n > {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#client:member} */\n client: ApolloClient;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#observable:member} */\n observable: ObservableQuery<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#previousData:member} */\n previousData?: MaybeMasked<TData>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member} */\n error?: ErrorLike;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#loading:member} */\n loading: boolean;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member} */\n networkStatus: NetworkStatus;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */\n startPolling: (pollInterval: number) => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */\n stopPolling: () => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */\n subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */\n updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: (\n variables?: Partial<TVariables>\n ) => Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */\n variables: TReturnVariables;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: <\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: ObservableQuery.FetchMoreOptions<\n TData,\n TVariables,\n TFetchData,\n TFetchVars\n >\n ) => Promise<ApolloClient.QueryResult<MaybeMasked<TFetchData>>>;\n }\n }\n export type Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TStates extends\n DataState<TData>[\"dataState\"] = DataState<TData>[\"dataState\"],\n TReturnVariables extends OperationVariables = TVariables,\n > = Base.Result<TData, TVariables, TReturnVariables> &\n GetDataState<MaybeMasked<TData>, TStates>;\n\n export interface DefaultOptions\n extends ApolloClient.DefaultOptions.WatchQuery.Calculated {\n skip: false;\n }\n\n export type ResultForOptions<\n TData,\n TVariables extends OperationVariables,\n TOptions extends\n | Record<string, never> // no options\n | Options<TData, TVariables>\n | SkipToken,\n > = LazyType<\n Result<\n TData,\n TVariables,\n | \"complete\"\n | \"streaming\"\n | \"empty\"\n | (TOptions extends any ?\n TOptions extends SkipToken ? never\n : OptionWithFallback<\n TOptions,\n DefaultOptions,\n \"returnPartialData\"\n > extends false ?\n never\n : \"partial\"\n : never)\n >\n >;\n\n export namespace DocumentationTypes {\n namespace useQuery {\n export interface Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Base.Result<TData, TVariables>,\n UtilityDocumentationTypes.DataState<TData> {}\n }\n }\n\n export namespace DocumentationTypes {\n export interface useQuery {\n /**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n *\n * ```jsx\n * import { gql } from \"@apollo/client\";\n * import { useQuery } from \"@apollo/client/react\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: \"english\" },\n * });\n * if (loading) return <p>Loading ...</p>;\n * return <h1>Hello {data.greeting.message}!</h1>;\n * }\n * ```\n *\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 Query result object\n */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<TData, TVariables>\n ): useQuery.Result<TData, TVariables>;\n }\n\n export interface useQuery_Deprecated {\n /**\n * @deprecated Avoid manually specifying generics on `useQuery`.\n * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.\n *\n * {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)}\n */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<TData, TVariables>\n ): useQuery.Result<TData, TVariables>;\n }\n }\n\n export namespace Signatures {\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n export interface Classic {\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken\n ): useQuery.Result<TData, TVariables, \"empty\", Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n ): useQuery.Result<TData, TVariables, \"empty\" | \"complete\" | \"streaming\">;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n : [\n options:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\",\n Partial<TVariables>\n >;\n\n ssrDisabledResult: ObservableQuery.Result<any>;\n }\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n export interface Modern {\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n Options extends never,\n >(\n query: {} extends TVariables ?\n DocumentNode | TypedDocumentNode<TData, TVariables>\n : // this overload should only be accessible if all `TVariables` are optional\n never\n ): useQuery.ResultForOptions<TData, TVariables, Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends SkipToken,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken\n ): useQuery.Result<TData, TVariables, \"empty\", Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &\n VariablesOption<\n TVariables & {\n [K in Exclude<\n keyof TOptions[\"variables\"],\n keyof TVariables\n >]?: never;\n }\n >,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: // we generally do not allow for a `TVariables` of `never`\n // TODO: check if we need a similar check in other hooks\n [TVariables] extends [never] ? [options: never]\n : // variables optional\n {} extends TVariables ? [options?: TOptions]\n : // variables required\n [options: TOptions]\n ): useQuery.ResultForOptions<TData, TVariables, TOptions>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &\n VariablesOption<\n TVariables & {\n [K in Exclude<\n keyof TOptions[\"variables\"],\n keyof TVariables\n >]?: never;\n }\n >,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: // we generally do not allow for a `TVariables` of `never`\n // TODO: check if we need a similar check in other hooks\n [TVariables] extends [never] ? [options: never]\n : // variables optional\n {} extends TVariables ? [options?: TOptions | SkipToken]\n : // variables required\n [options: TOptions | SkipToken]\n ): useQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;\n\n ssrDisabledResult: ObservableQuery.Result<any>;\n }\n\n export type Evaluated = SignatureStyle extends \"classic\" ? Classic : Modern;\n }\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n export interface Signature extends Signatures.Evaluated {}\n}\n\nconst lastWatchOptions = Symbol();\n\ninterface ObsQueryWithMeta<TData, TVariables extends OperationVariables>\n extends ObservableQuery<TData, TVariables> {\n [lastWatchOptions]?: Readonly<\n ApolloClient.WatchQueryOptions<TData, TVariables>\n >;\n}\n\ninterface InternalResult<TData> {\n // These members are populated by getCurrentResult and setResult, and it's\n // okay/normal for them to be initially undefined.\n current: ObservableQuery.Result<TData>;\n previousData?: undefined | MaybeMasked<TData>;\n\n // Track current variables separately in case a call to e.g. `refetch(newVars)`\n // causes an emit that is deeply equal to the current result. This lets us\n // compare if we should force rerender due to changed variables\n variables: OperationVariables;\n}\n\ninterface InternalState<TData, TVariables extends OperationVariables> {\n client: ReturnType<typeof useApolloClient>;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n observable: ObsQueryWithMeta<TData, TVariables>;\n resultData: InternalResult<TData>;\n}\n\nexport const useQuery: useQuery.Signature = function useQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n : [options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n): useQuery.Result<TData, TVariables> {\n \"use no memo\";\n return wrapHook(\n \"useQuery\",\n useQuery_,\n useApolloClient(typeof options === \"object\" ? options.client : undefined)\n )(query, options);\n} as any;\n\nfunction useQuery_<TData, TVariables extends OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | useQuery.Options<\n NoInfer<TData>,\n NoInfer<TVariables>\n > = {} as useQuery.Options<TData, TVariables>\n): useQuery.Result<TData, TVariables> {\n const client = useApolloClient(\n typeof options === \"object\" ? options.client : undefined\n );\n const { ssr } = typeof options === \"object\" ? options : {};\n\n const watchQueryOptions = useOptions(\n query,\n options,\n client.defaultOptions.watchQuery\n );\n\n function createState(\n previous?: InternalState<TData, TVariables>\n ): InternalState<TData, TVariables> {\n const observable = client.watchQuery(watchQueryOptions);\n\n return {\n client,\n query,\n observable,\n resultData: {\n current: observable.getCurrentResult(),\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n previousData: previous?.resultData.current.data as TData,\n variables: observable.variables,\n },\n };\n }\n\n let [state, setState] = React.useState(createState);\n\n if (client !== state.client || query !== state.query) {\n // If the client or query have changed, we need to create a new InternalState.\n // This will trigger a re-render with the new state, but it will also continue\n // to run the current render function to completion.\n // Since we sometimes trigger some side-effects in the render function, we\n // re-assign `state` to the new state to ensure that those side-effects are\n // triggered with the new state.\n setState((state = createState(state)));\n }\n\n const { observable, resultData } = state;\n\n useInitialFetchPolicyIfNecessary<TData, TVariables>(\n watchQueryOptions,\n observable\n );\n\n useResubscribeIfNecessary<TData, TVariables>(\n resultData, // might get mutated during render\n observable, // might get mutated during render\n watchQueryOptions\n );\n\n const result = useResult<TData, TVariables>(observable, resultData, ssr);\n\n const obsQueryFields = React.useMemo(\n () => ({\n refetch: observable.refetch.bind(observable),\n fetchMore: observable.fetchMore.bind(observable),\n updateQuery: observable.updateQuery.bind(observable),\n startPolling: observable.startPolling.bind(observable),\n stopPolling: observable.stopPolling.bind(observable),\n subscribeToMore: observable.subscribeToMore.bind(observable),\n }),\n [observable]\n );\n\n const previousData = resultData.previousData;\n return React.useMemo(() => {\n const { partial, ...rest } = result;\n\n return {\n ...rest,\n client,\n observable,\n variables: observable.variables,\n previousData,\n ...obsQueryFields,\n };\n }, [result, client, observable, previousData, obsQueryFields]);\n}\n\nconst fromSkipToken = Symbol();\n\nfunction useOptions<TData, TVariables extends OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n defaultOptions: Partial<ApolloClient.WatchQueryOptions<any, any>> | undefined\n): ApolloClient.WatchQueryOptions<TData, TVariables> {\n return useDeepMemo<ApolloClient.WatchQueryOptions<TData, TVariables>>(() => {\n if (options === skipToken) {\n const opts: ApolloClient.WatchQueryOptions<TData, TVariables> = {\n ...mergeOptions(defaultOptions as any, {\n query,\n fetchPolicy: \"standby\",\n }),\n [variablesUnknownSymbol]: true,\n };\n (opts as any)[fromSkipToken] = true;\n\n return opts;\n }\n\n const watchQueryOptions: ApolloClient.WatchQueryOptions<TData, TVariables> =\n mergeOptions(defaultOptions as any, { ...options, query });\n\n if (options.skip) {\n watchQueryOptions.initialFetchPolicy =\n options.initialFetchPolicy || options.fetchPolicy;\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n\n return watchQueryOptions;\n }, [query, options, defaultOptions]);\n}\n\nfunction useInitialFetchPolicyIfNecessary<\n TData,\n TVariables extends OperationVariables,\n>(\n watchQueryOptions: ApolloClient.WatchQueryOptions<TData, TVariables>,\n observable: ObsQueryWithMeta<TData, TVariables>\n) {\n \"use no memo\";\n if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy = observable.options.initialFetchPolicy;\n }\n}\n\nfunction useResult<TData, TVariables extends OperationVariables>(\n observable: ObsQueryWithMeta<TData, TVariables>,\n resultData: InternalResult<TData>,\n ssr: boolean | undefined\n) {\n \"use no memo\";\n const fetchPolicy = observable.options.fetchPolicy;\n return useSyncExternalStore(\n React.useCallback(\n (handleStoreChange) => {\n const subscription = observable\n // We use the asapScheduler here to prevent issues with trying to\n // update in the middle of a render. `reobserve` is kicked off in the\n // middle of a render and because RxJS emits values synchronously,\n // its possible for this `handleStoreChange` to be called in that same\n // render. This allows the render to complete before trying to emit a\n // new value.\n .pipe(observeOn(asapScheduler))\n .subscribe((result) => {\n const previous = resultData.current;\n\n if (\n // Avoid rerendering if the result is the same\n equal(previous, result) &&\n // Force rerender if the value was emitted because variables\n // changed, such as when calling `refetch(newVars)` which returns\n // the same data when `notifyOnNetworkStatusChange` is `false`.\n equal(resultData.variables, observable.variables)\n ) {\n return;\n }\n\n resultData.variables = observable.variables;\n\n if (previous.data && !equal(previous.data, result.data)) {\n resultData.previousData = previous.data as TData;\n }\n\n resultData.current = result;\n handleStoreChange();\n });\n\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return () => {\n setTimeout(() => subscription.unsubscribe());\n };\n },\n\n [observable, resultData]\n ),\n () => resultData.current,\n () =>\n (\n (fetchPolicy !== \"standby\" && ssr === false) ||\n fetchPolicy === \"no-cache\"\n ) ?\n useQuery.ssrDisabledResult\n : resultData.current\n );\n}\n\n// this hook is not compatible with any rules of React, and there's no good way to rewrite it.\n// it should stay a separate hook that will not be optimized by the compiler\nfunction useResubscribeIfNecessary<\n TData,\n TVariables extends OperationVariables,\n>(\n /** this hook will mutate properties on `resultData` */\n resultData: InternalResult<TData>,\n /** this hook will mutate properties on `observable` */\n observable: ObsQueryWithMeta<TData, TVariables>,\n watchQueryOptions: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>\n) {\n \"use no memo\";\n if (\n observable[lastWatchOptions] &&\n !equal(observable[lastWatchOptions], watchQueryOptions)\n ) {\n // If skipToken was used to generate options, we won't know the correct\n // initialFetchPolicy until the hook is rerendered with real options, so we\n // set it the next time we get real options\n if (\n (observable[lastWatchOptions] as any)[fromSkipToken] &&\n !watchQueryOptions.initialFetchPolicy\n ) {\n (watchQueryOptions.initialFetchPolicy as any) =\n watchQueryOptions.fetchPolicy;\n }\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n if (shouldReobserve(observable[lastWatchOptions], watchQueryOptions)) {\n observable.reobserve(watchQueryOptions);\n } else {\n observable.applyOptions(watchQueryOptions);\n }\n\n // Make sure getCurrentResult returns a fresh ApolloQueryResult<TData>,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n const result = observable.getCurrentResult();\n\n if (!equal(result.data, resultData.current.data)) {\n resultData.previousData = (resultData.current.data ||\n (resultData.previousData as TData)) as TData;\n }\n resultData.current = result;\n resultData.variables = observable.variables;\n }\n observable[lastWatchOptions] = watchQueryOptions;\n}\n\nfunction shouldReobserve<TData, TVariables extends OperationVariables>(\n previousOptions: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>,\n options: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>\n) {\n return (\n previousOptions.query !== options.query ||\n !equal(previousOptions.variables, options.variables) ||\n (previousOptions.fetchPolicy !== options.fetchPolicy &&\n (options.fetchPolicy === \"standby\" ||\n previousOptions.fetchPolicy === \"standby\"))\n );\n}\n\nuseQuery.ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0 as any,\n dataState: \"empty\",\n error: void 0,\n networkStatus: NetworkStatus.loading,\n partial: true,\n}) satisfies ObservableQuery.Result<any> as ObservableQuery.Result<any>;\n"]}
1
+ {"version":3,"file":"useQuery.js","sourceRoot":"","sources":["../../../src/react/hooks/useQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO;AACP,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAoBhD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAU/C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAuiBjE,MAAM,gBA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AAC;QAE7C,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACjD,UAAU,CAAC,YAAY,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI;gBAC/C,UAAU,CAAC,YAAsB,CAAU,CAAC;QACjD,CAAC;QACD,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;QAC5B,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IAC9C,CAAC;IACD,UAAU,CAAC,gBAAgB,CAAC,GAAG,iBAAiB,CAAC;AACnD,CAAC;AAED,SAAS,eAAe,CACtB,eAA4E,EAC5E,OAAoE;IAEpE,OAAO,CACL,eAAe,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK;QACvC,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC;QACpD,CAAC,eAAe,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW;YAClD,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS;gBAChC,eAAe,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC3C,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,KAAK,CAAQ;IACnB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,aAAa,CAAC,OAAO;IACpC,OAAO,EAAE,IAAI;CACd,CAAsE,CAAC","sourcesContent":["/**\n * Function parameters in this file try to follow a common order for the sake of\n * readability and consistency. The order is as follows:\n *\n * resultData\n * observable\n * client\n * query\n * options\n * watchQueryOptions\n * makeWatchQueryOptions\n */\n/** */\nimport { equal } from \"@wry/equality\";\nimport * as React from \"react\";\nimport { asapScheduler, observeOn } from \"rxjs\";\n\nimport type {\n DataState,\n DefaultContext,\n DocumentNode,\n ErrorLike,\n ErrorPolicy,\n GetDataState,\n InternalTypes,\n ObservableQuery,\n OperationVariables,\n RefetchOn,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n TypedDocumentNode,\n UpdateQueryMapFn,\n WatchQueryFetchPolicy,\n} from \"@apollo/client\";\nimport type { ApolloClient } from \"@apollo/client\";\nimport { NetworkStatus } from \"@apollo/client\";\nimport type { MaybeMasked } from \"@apollo/client/masking\";\nimport type {\n DocumentationTypes as UtilityDocumentationTypes,\n LazyType,\n NoInfer,\n OptionWithFallback,\n SignatureStyle,\n VariablesOption,\n} from \"@apollo/client/utilities/internal\";\nimport {\n maybeDeepFreeze,\n mergeOptions,\n variablesUnknownSymbol,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { SkipToken } from \"./constants.js\";\nimport { skipToken } from \"./constants.js\";\nimport { useDeepMemo, wrapHook } from \"./internal/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n\nexport declare namespace useQuery {\n import _self = useQuery;\n export namespace Base {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#nextFetchPolicy:member} */\n nextFetchPolicy?:\n | WatchQueryFetchPolicy\n | ((\n this: ApolloClient.WatchQueryOptions<TData, TVariables>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: InternalTypes.NextFetchPolicyContext<TData, TVariables>\n ) => WatchQueryFetchPolicy);\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#initialFetchPolicy:member} */\n\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skipPollAttempt:member} */\n skipPollAttempt?: () => boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */\n ssr?: boolean;\n\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#skip:member} */\n skip?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchOn:member} */\n refetchOn?: RefetchOn.Option;\n }\n }\n export type Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > = Base.Options<TData, TVariables> & VariablesOption<TVariables>;\n\n export namespace DocumentationTypes {\n namespace useQuery {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Base.Options<TData, TVariables>,\n UtilityDocumentationTypes.VariableOptions<TVariables> {}\n }\n }\n\n export namespace Base {\n export interface Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TReturnVariables extends OperationVariables = TVariables,\n > {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#client:member} */\n client: ApolloClient;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#observable:member} */\n observable: ObservableQuery<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#previousData:member} */\n previousData?: MaybeMasked<TData>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#error:member} */\n error?: ErrorLike;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#loading:member} */\n loading: boolean;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#networkStatus:member} */\n networkStatus: NetworkStatus;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */\n startPolling: (pollInterval: number) => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */\n stopPolling: () => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */\n subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */\n updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */\n refetch: (\n variables?: Partial<TVariables>\n ) => Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */\n variables: TReturnVariables;\n\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */\n fetchMore: <\n TFetchData = TData,\n TFetchVars extends OperationVariables = TVariables,\n >(\n fetchMoreOptions: ObservableQuery.FetchMoreOptions<\n TData,\n TVariables,\n TFetchData,\n TFetchVars\n >\n ) => Promise<ApolloClient.QueryResult<MaybeMasked<TFetchData>>>;\n }\n }\n export type Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n TStates extends\n DataState<TData>[\"dataState\"] = DataState<TData>[\"dataState\"],\n TReturnVariables extends OperationVariables = TVariables,\n > = Base.Result<TData, TVariables, TReturnVariables> &\n GetDataState<MaybeMasked<TData>, TStates>;\n\n export interface DefaultOptions\n extends ApolloClient.DefaultOptions.WatchQuery.Calculated {\n skip: false;\n }\n\n export type ResultForOptions<\n TData,\n TVariables extends OperationVariables,\n TOptions extends\n | Record<string, never> // no options\n | Options<TData, TVariables>\n | SkipToken,\n > = LazyType<\n Result<\n TData,\n TVariables,\n | \"complete\"\n | \"streaming\"\n | \"empty\"\n | (TOptions extends any ?\n TOptions extends SkipToken ? never\n : OptionWithFallback<\n TOptions,\n DefaultOptions,\n \"returnPartialData\"\n > extends false ?\n never\n : \"partial\"\n : never)\n >\n >;\n\n export namespace DocumentationTypes {\n namespace useQuery {\n export interface Result<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Base.Result<TData, TVariables>,\n UtilityDocumentationTypes.DataState<TData> {}\n }\n }\n\n export namespace DocumentationTypes {\n export interface useQuery {\n /**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n *\n * ```jsx\n * import { gql } from \"@apollo/client\";\n * import { useQuery } from \"@apollo/client/react\";\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: \"english\" },\n * });\n * if (loading) return <p>Loading ...</p>;\n * return <h1>Hello {data.greeting.message}!</h1>;\n * }\n * ```\n *\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 Query result object\n */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<TData, TVariables>\n ): useQuery.Result<TData, TVariables>;\n }\n\n export interface useQuery_Deprecated {\n /**\n * @deprecated Avoid manually specifying generics on `useQuery`.\n * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.\n *\n * {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)}\n */\n <\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<TData, TVariables>\n ): useQuery.Result<TData, TVariables>;\n }\n }\n\n export namespace Signatures {\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n export interface Classic {\n // _INFERENCE_ONLY_DO_NOT_SPECIFY is used to distinguish between inferred\n // generics arguments and explicit generic arguments so that we can\n // provide a `@deprecated` signature for explicit generic arguments. As\n // soon as a user provides a generic arg (e.g. useQuery<TData>(query))`,\n // the overload falls through to the overloads without\n // _INFERENCE_ONLY_DO_NOT_SPECIFY.\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken\n ): useQuery.Result<TData, TVariables, \"empty\", Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n ): useQuery.Result<TData, TVariables, \"empty\" | \"complete\" | \"streaming\">;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n _INFERENCE_ONLY_DO_NOT_SPECIFY extends \"inferred\",\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n : [\n options:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken\n ): useQuery.Result<TData, TVariables, \"empty\", Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: true;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n }\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\"\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {\n returnPartialData: boolean;\n })\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\" | \"partial\",\n Partial<TVariables>\n >;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n ): useQuery.Result<TData, TVariables, \"empty\" | \"complete\" | \"streaming\">;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery_Deprecated:call(1)} */\n <TData, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n : [\n options:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n ): useQuery.Result<\n TData,\n TVariables,\n \"empty\" | \"complete\" | \"streaming\",\n Partial<TVariables>\n >;\n\n ssrDisabledResult: ObservableQuery.Result<any>;\n }\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n export interface Modern {\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n Options extends never,\n >(\n query: {} extends TVariables ?\n DocumentNode | TypedDocumentNode<TData, TVariables>\n : // this overload should only be accessible if all `TVariables` are optional\n never\n ): useQuery.ResultForOptions<TData, TVariables, Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &\n VariablesOption<\n TVariables & {\n [K in Exclude<\n keyof TOptions[\"variables\"],\n keyof TVariables\n >]?: never;\n }\n >,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: // we generally do not allow for a `TVariables` of `never`\n // TODO: check if we need a similar check in other hooks\n [TVariables] extends [never] ? [options: never]\n : // variables optional\n {} extends TVariables ? [options?: TOptions]\n : // variables required\n [options: TOptions]\n ): useQuery.ResultForOptions<TData, TVariables, TOptions>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends SkipToken,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken\n ): useQuery.Result<TData, TVariables, \"empty\", Record<string, never>>;\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n <\n TData,\n TVariables extends OperationVariables,\n // this overload should never be manually defined, it should always be inferred\n TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &\n VariablesOption<\n TVariables & {\n [K in Exclude<\n keyof TOptions[\"variables\"],\n keyof TVariables\n >]?: never;\n }\n >,\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: // we generally do not allow for a `TVariables` of `never`\n // TODO: check if we need a similar check in other hooks\n [TVariables] extends [never] ? [options: never]\n : // variables optional\n {} extends TVariables ? [options?: TOptions | SkipToken]\n : // variables required\n [options: TOptions | SkipToken]\n ): useQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;\n\n ssrDisabledResult: ObservableQuery.Result<any>;\n }\n\n export type Evaluated = SignatureStyle extends \"classic\" ? Classic : Modern;\n }\n\n /** {@inheritDoc @apollo/client/react!useQuery.DocumentationTypes.useQuery:call(1)} */\n export interface Signature extends Signatures.Evaluated {}\n}\n\nconst lastWatchOptions = Symbol();\n\ninterface ObsQueryWithMeta<TData, TVariables extends OperationVariables>\n extends ObservableQuery<TData, TVariables> {\n [lastWatchOptions]?: Readonly<\n ApolloClient.WatchQueryOptions<TData, TVariables>\n >;\n}\n\ninterface InternalResult<TData> {\n // These members are populated by getCurrentResult and setResult, and it's\n // okay/normal for them to be initially undefined.\n current: ObservableQuery.Result<TData>;\n previousData?: undefined | MaybeMasked<TData>;\n\n // Track current variables separately in case a call to e.g. `refetch(newVars)`\n // causes an emit that is deeply equal to the current result. This lets us\n // compare if we should force rerender due to changed variables\n variables: OperationVariables;\n}\n\ninterface InternalState<TData, TVariables extends OperationVariables> {\n client: ReturnType<typeof useApolloClient>;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n observable: ObsQueryWithMeta<TData, TVariables>;\n resultData: InternalResult<TData>;\n}\n\nexport const useQuery: useQuery.Signature = function useQuery<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n ...[options]: {} extends TVariables ?\n [\n options?:\n | SkipToken\n | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n ]\n : [options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]\n): useQuery.Result<TData, TVariables> {\n \"use no memo\";\n return wrapHook(\n \"useQuery\",\n useQuery_,\n useApolloClient(typeof options === \"object\" ? options.client : undefined)\n )(query, options);\n} as any;\n\nfunction useQuery_<TData, TVariables extends OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options:\n | SkipToken\n | useQuery.Options<\n NoInfer<TData>,\n NoInfer<TVariables>\n > = {} as useQuery.Options<TData, TVariables>\n): useQuery.Result<TData, TVariables> {\n const client = useApolloClient(\n typeof options === \"object\" ? options.client : undefined\n );\n const { ssr } = typeof options === \"object\" ? options : {};\n\n const watchQueryOptions = useOptions(\n query,\n options,\n client.defaultOptions.watchQuery\n );\n\n function createState(\n previous?: InternalState<TData, TVariables>\n ): InternalState<TData, TVariables> {\n const observable = client.watchQuery(watchQueryOptions);\n\n return {\n client,\n query,\n observable,\n resultData: {\n current: observable.getCurrentResult(),\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n previousData: previous?.resultData.current.data as TData,\n variables: observable.variables,\n },\n };\n }\n\n let [state, setState] = React.useState(createState);\n\n if (client !== state.client || query !== state.query) {\n // If the client or query have changed, we need to create a new InternalState.\n // This will trigger a re-render with the new state, but it will also continue\n // to run the current render function to completion.\n // Since we sometimes trigger some side-effects in the render function, we\n // re-assign `state` to the new state to ensure that those side-effects are\n // triggered with the new state.\n setState((state = createState(state)));\n }\n\n const { observable, resultData } = state;\n\n useInitialFetchPolicyIfNecessary<TData, TVariables>(\n watchQueryOptions,\n observable\n );\n\n useResubscribeIfNecessary<TData, TVariables>(\n resultData, // might get mutated during render\n observable, // might get mutated during render\n watchQueryOptions\n );\n\n const result = useResult<TData, TVariables>(observable, resultData, ssr);\n\n const obsQueryFields = React.useMemo(\n () => ({\n refetch: observable.refetch.bind(observable),\n fetchMore: observable.fetchMore.bind(observable),\n updateQuery: observable.updateQuery.bind(observable),\n startPolling: observable.startPolling.bind(observable),\n stopPolling: observable.stopPolling.bind(observable),\n subscribeToMore: observable.subscribeToMore.bind(observable),\n }),\n [observable]\n );\n\n const previousData = resultData.previousData;\n return React.useMemo(() => {\n const { partial, ...rest } = result;\n\n return {\n ...rest,\n client,\n observable,\n variables: observable.variables,\n previousData,\n ...obsQueryFields,\n };\n }, [result, client, observable, previousData, obsQueryFields]);\n}\n\nconst fromSkipToken = Symbol();\n\nfunction useOptions<TData, TVariables extends OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>,\n defaultOptions: Partial<ApolloClient.WatchQueryOptions<any, any>> | undefined\n): ApolloClient.WatchQueryOptions<TData, TVariables> {\n return useDeepMemo<ApolloClient.WatchQueryOptions<TData, TVariables>>(() => {\n if (options === skipToken) {\n const opts: ApolloClient.WatchQueryOptions<TData, TVariables> = {\n ...mergeOptions(defaultOptions as any, {\n query,\n fetchPolicy: \"standby\",\n }),\n [variablesUnknownSymbol]: true,\n };\n (opts as any)[fromSkipToken] = true;\n\n return opts;\n }\n\n const watchQueryOptions: ApolloClient.WatchQueryOptions<TData, TVariables> =\n mergeOptions(defaultOptions as any, { ...options, query });\n\n if (options.skip) {\n watchQueryOptions.initialFetchPolicy =\n options.initialFetchPolicy || options.fetchPolicy;\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n\n return watchQueryOptions;\n }, [query, options, defaultOptions]);\n}\n\nfunction useInitialFetchPolicyIfNecessary<\n TData,\n TVariables extends OperationVariables,\n>(\n watchQueryOptions: ApolloClient.WatchQueryOptions<TData, TVariables>,\n observable: ObsQueryWithMeta<TData, TVariables>\n) {\n \"use no memo\";\n if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy = observable.options.initialFetchPolicy;\n }\n}\n\nfunction useResult<TData, TVariables extends OperationVariables>(\n observable: ObsQueryWithMeta<TData, TVariables>,\n resultData: InternalResult<TData>,\n ssr: boolean | undefined\n) {\n \"use no memo\";\n const fetchPolicy = observable.options.fetchPolicy;\n return useSyncExternalStore(\n React.useCallback(\n (handleStoreChange) => {\n const subscription = observable\n // We use the asapScheduler here to prevent issues with trying to\n // update in the middle of a render. `reobserve` is kicked off in the\n // middle of a render and because RxJS emits values synchronously,\n // its possible for this `handleStoreChange` to be called in that same\n // render. This allows the render to complete before trying to emit a\n // new value.\n .pipe(observeOn(asapScheduler))\n .subscribe((result) => {\n const previous = resultData.current;\n\n if (\n // Avoid rerendering if the result is the same\n equal(previous, result) &&\n // Force rerender if the value was emitted because variables\n // changed, such as when calling `refetch(newVars)` which returns\n // the same data when `notifyOnNetworkStatusChange` is `false`.\n equal(resultData.variables, observable.variables)\n ) {\n return;\n }\n\n resultData.variables = observable.variables;\n\n if (previous.data && !equal(previous.data, result.data)) {\n resultData.previousData = previous.data as TData;\n }\n\n resultData.current = result;\n handleStoreChange();\n });\n\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return () => {\n setTimeout(() => subscription.unsubscribe());\n };\n },\n\n [observable, resultData]\n ),\n () => resultData.current,\n () =>\n (\n (fetchPolicy !== \"standby\" && ssr === false) ||\n fetchPolicy === \"no-cache\"\n ) ?\n useQuery.ssrDisabledResult\n : resultData.current\n );\n}\n\n// this hook is not compatible with any rules of React, and there's no good way to rewrite it.\n// it should stay a separate hook that will not be optimized by the compiler\nfunction useResubscribeIfNecessary<\n TData,\n TVariables extends OperationVariables,\n>(\n /** this hook will mutate properties on `resultData` */\n resultData: InternalResult<TData>,\n /** this hook will mutate properties on `observable` */\n observable: ObsQueryWithMeta<TData, TVariables>,\n watchQueryOptions: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>\n) {\n \"use no memo\";\n if (\n observable[lastWatchOptions] &&\n !equal(observable[lastWatchOptions], watchQueryOptions)\n ) {\n // If skipToken was used to generate options, we won't know the correct\n // initialFetchPolicy until the hook is rerendered with real options, so we\n // set it the next time we get real options\n if (\n (observable[lastWatchOptions] as any)[fromSkipToken] &&\n !watchQueryOptions.initialFetchPolicy\n ) {\n (watchQueryOptions.initialFetchPolicy as any) =\n watchQueryOptions.fetchPolicy;\n }\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n if (shouldReobserve(observable[lastWatchOptions], watchQueryOptions)) {\n observable.reobserve(watchQueryOptions);\n } else {\n observable.applyOptions(watchQueryOptions);\n }\n\n // Make sure getCurrentResult returns a fresh ApolloQueryResult<TData>,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n const result = observable.getCurrentResult();\n\n if (!equal(result.data, resultData.current.data)) {\n resultData.previousData = (resultData.current.data ||\n (resultData.previousData as TData)) as TData;\n }\n resultData.current = result;\n resultData.variables = observable.variables;\n }\n observable[lastWatchOptions] = watchQueryOptions;\n}\n\nfunction shouldReobserve<TData, TVariables extends OperationVariables>(\n previousOptions: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>,\n options: Readonly<ApolloClient.WatchQueryOptions<TData, TVariables>>\n) {\n return (\n previousOptions.query !== options.query ||\n !equal(previousOptions.variables, options.variables) ||\n (previousOptions.fetchPolicy !== options.fetchPolicy &&\n (options.fetchPolicy === \"standby\" ||\n previousOptions.fetchPolicy === \"standby\"))\n );\n}\n\nuseQuery.ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0 as any,\n dataState: \"empty\",\n error: void 0,\n networkStatus: NetworkStatus.loading,\n partial: true,\n}) satisfies ObservableQuery.Result<any> as ObservableQuery.Result<any>;\n"]}