@apollo/client 3.10.7 → 3.11.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/.changeset/angry-ravens-mate.md +5 -0
  2. package/.changeset/angry-seals-jog.md +5 -0
  3. package/.changeset/chilly-dots-shake.md +5 -0
  4. package/.changeset/clever-bikes-admire.md +5 -0
  5. package/.changeset/flat-onions-guess.md +5 -0
  6. package/.changeset/fluffy-badgers-rush.md +5 -0
  7. package/.changeset/little-suits-return.md +5 -0
  8. package/.changeset/nasty-olives-act.md +5 -0
  9. package/.changeset/pink-ants-remember.md +16 -0
  10. package/.changeset/pre.json +24 -0
  11. package/.changeset/slimy-balloons-cheat.md +5 -0
  12. package/.changeset/slimy-berries-yawn.md +14 -0
  13. package/.changeset/tasty-chairs-dress.md +5 -0
  14. package/.changeset/thin-lies-begin.md +5 -0
  15. package/.changeset/unlucky-birds-press.md +5 -0
  16. package/.changeset/weak-ads-develop.md +5 -0
  17. package/CHANGELOG.md +66 -4
  18. package/apollo-client.cjs +501 -410
  19. package/apollo-client.cjs.map +1 -1
  20. package/apollo-client.min.cjs +1 -1
  21. package/cache/core/types/common.d.ts +1 -1
  22. package/cache/core/types/common.js.map +1 -1
  23. package/core/ApolloClient.d.ts +24 -2
  24. package/core/ApolloClient.js +9 -8
  25. package/core/ApolloClient.js.map +1 -1
  26. package/core/ObservableQuery.js +5 -1
  27. package/core/ObservableQuery.js.map +1 -1
  28. package/core/QueryInfo.d.ts +2 -2
  29. package/core/QueryInfo.js.map +1 -1
  30. package/core/QueryManager.d.ts +1 -1
  31. package/core/QueryManager.js +5 -4
  32. package/core/QueryManager.js.map +1 -1
  33. package/core/core.cjs +18 -11
  34. package/core/core.cjs.map +1 -1
  35. package/core/core.cjs.native.js +18 -11
  36. package/core/types.d.ts +2 -2
  37. package/core/types.js.map +1 -1
  38. package/core/watchQueryOptions.d.ts +4 -0
  39. package/core/watchQueryOptions.js.map +1 -1
  40. package/dev/dev.cjs +40 -34
  41. package/dev/dev.cjs.map +1 -1
  42. package/dev/dev.cjs.native.js +40 -34
  43. package/errors/errors.cjs +4 -0
  44. package/errors/errors.cjs.map +1 -1
  45. package/errors/errors.cjs.native.js +4 -0
  46. package/errors/index.d.ts +18 -3
  47. package/errors/index.js +7 -2
  48. package/errors/index.js.map +1 -1
  49. package/invariantErrorCodes.js +41 -34
  50. package/link/core/types.d.ts +6 -4
  51. package/link/core/types.js.map +1 -1
  52. package/link/error/index.d.ts +4 -4
  53. package/link/error/index.js.map +1 -1
  54. package/link/persisted-queries/index.d.ts +3 -3
  55. package/link/persisted-queries/index.js.map +1 -1
  56. package/link/subscriptions/index.js +1 -0
  57. package/link/subscriptions/index.js.map +1 -1
  58. package/link/subscriptions/subscriptions.cjs.map +1 -1
  59. package/package.json +29 -29
  60. package/react/hooks/hooks.cjs +445 -368
  61. package/react/hooks/hooks.cjs.map +1 -1
  62. package/react/hooks/hooks.cjs.native.js +445 -368
  63. package/react/hooks/internal/wrapHook.d.ts +2 -0
  64. package/react/hooks/internal/wrapHook.js.map +1 -1
  65. package/react/hooks/useBackgroundQuery.d.ts +15 -1
  66. package/react/hooks/useBackgroundQuery.js +5 -1
  67. package/react/hooks/useBackgroundQuery.js.map +1 -1
  68. package/react/hooks/useLazyQuery.js +54 -12
  69. package/react/hooks/useLazyQuery.js.map +1 -1
  70. package/react/hooks/useLoadableQuery.d.ts +7 -1
  71. package/react/hooks/useLoadableQuery.js +5 -1
  72. package/react/hooks/useLoadableQuery.js.map +1 -1
  73. package/react/hooks/useQuery.d.ts +34 -47
  74. package/react/hooks/useQuery.js +387 -388
  75. package/react/hooks/useQuery.js.map +1 -1
  76. package/react/hooks/useQueryRefHandlers.d.ts +7 -1
  77. package/react/hooks/useQueryRefHandlers.js +5 -1
  78. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  79. package/react/hooks/useSubscription.d.ts +13 -10
  80. package/react/hooks/useSubscription.js +130 -98
  81. package/react/hooks/useSubscription.js.map +1 -1
  82. package/react/hooks/useSuspenseQuery.js +3 -3
  83. package/react/hooks/useSuspenseQuery.js.map +1 -1
  84. package/react/hooks/useSyncExternalStore.js +1 -1
  85. package/react/internal/cache/QueryReference.js +1 -1
  86. package/react/internal/internal.cjs +2 -2
  87. package/react/internal/internal.cjs.map +1 -1
  88. package/react/internal/internal.cjs.native.js +2 -2
  89. package/react/parser/index.js +5 -5
  90. package/react/parser/parser.cjs +5 -5
  91. package/react/parser/parser.cjs.map +1 -1
  92. package/react/parser/parser.cjs.native.js +5 -5
  93. package/react/query-preloader/createQueryPreloader.js +5 -1
  94. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  95. package/react/react.cjs +12 -1
  96. package/react/react.cjs.map +1 -1
  97. package/react/react.cjs.native.js +12 -1
  98. package/react/types/types.d.ts +19 -0
  99. package/react/types/types.documentation.d.ts +10 -0
  100. package/react/types/types.documentation.js.map +1 -1
  101. package/react/types/types.js.map +1 -1
  102. package/testing/core/core.cjs +6 -5
  103. package/testing/core/core.cjs.map +1 -1
  104. package/testing/core/core.cjs.native.js +6 -5
  105. package/testing/core/mocking/mockLink.js +8 -7
  106. package/testing/core/mocking/mockLink.js.map +1 -1
  107. package/testing/experimental/createSchemaFetch.d.ts +2 -0
  108. package/testing/experimental/createSchemaFetch.js +12 -1
  109. package/testing/experimental/createSchemaFetch.js.map +1 -1
  110. package/testing/experimental/createTestSchema.d.ts +2 -0
  111. package/testing/experimental/createTestSchema.js +2 -0
  112. package/testing/experimental/createTestSchema.js.map +1 -1
  113. package/testing/experimental/experimental.cjs +5 -1
  114. package/testing/experimental/experimental.cjs.map +1 -1
  115. package/testing/experimental/experimental.cjs.native.js +5 -1
  116. package/testing/internal/disposables/enableFakeTimers.d.ts +7 -0
  117. package/testing/internal/disposables/enableFakeTimers.js +16 -0
  118. package/testing/internal/disposables/enableFakeTimers.js.map +1 -0
  119. package/testing/internal/disposables/index.d.ts +1 -0
  120. package/testing/internal/disposables/index.js +1 -0
  121. package/testing/internal/disposables/index.js.map +1 -1
  122. package/utilities/common/errorHandling.d.ts +1 -1
  123. package/utilities/globals/globals.cjs +1 -1
  124. package/utilities/globals/globals.cjs.map +1 -1
  125. package/utilities/globals/globals.cjs.native.js +1 -1
  126. package/utilities/graphql/DocumentTransform.js +1 -1
  127. package/utilities/graphql/directives.js +4 -4
  128. package/utilities/graphql/fragments.js +3 -3
  129. package/utilities/graphql/getFromAST.js +8 -8
  130. package/utilities/graphql/storeUtils.js +1 -1
  131. package/utilities/graphql/transform.js +2 -2
  132. package/utilities/utilities.cjs +19 -19
  133. package/utilities/utilities.cjs.map +1 -1
  134. package/utilities/utilities.cjs.native.js +19 -19
  135. package/version.js +1 -1
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Add support for `subscribeToMore` function to `useQueryRefHandlers`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Support extensions in useSubscription
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Add support for `subscribeToMore` function to `useLoadableQuery`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Add `restart` function to `useSubscription`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Add `cause` field to `ApolloError`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ MockLink: add query default variables if not specified in mock request
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Reimplement `useSubscription` to fix rules of React violations.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Rewrite big parts of `useQuery` and `useLazyQuery` to be more compliant with the Rules of React and React Compiler
@@ -0,0 +1,16 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Add the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the `connectToDevtools` option in favor of a new `devtools` configuration.
6
+
7
+ ```ts
8
+ new ApolloClient({
9
+ devtools: {
10
+ enabled: true,
11
+ name: "Test Client",
12
+ },
13
+ });
14
+ ```
15
+
16
+ This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
@@ -0,0 +1,24 @@
1
+ {
2
+ "mode": "pre",
3
+ "tag": "rc",
4
+ "initialVersions": {
5
+ "@apollo/client": "3.10.8"
6
+ },
7
+ "changesets": [
8
+ "angry-ravens-mate",
9
+ "angry-seals-jog",
10
+ "chilly-dots-shake",
11
+ "clever-bikes-admire",
12
+ "flat-onions-guess",
13
+ "fluffy-badgers-rush",
14
+ "little-suits-return",
15
+ "nasty-olives-act",
16
+ "pink-ants-remember",
17
+ "slimy-balloons-cheat",
18
+ "slimy-berries-yawn",
19
+ "tasty-chairs-dress",
20
+ "thin-lies-begin",
21
+ "unlucky-birds-press",
22
+ "weak-ads-develop"
23
+ ]
24
+ }
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Add support for `subscribeToMore` function to `useBackgroundQuery`.
@@ -0,0 +1,14 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Changes usages of the `GraphQLError` type to `GraphQLFormattedError`.
6
+
7
+ This was a type bug - these errors were never `GraphQLError` instances
8
+ to begin with, and the `GraphQLError` class has additional properties that can
9
+ never be correctly rehydrated from a GraphQL result.
10
+ The correct type to use here is `GraphQLFormattedError`.
11
+
12
+ Similarly, please ensure to use the type `FormattedExecutionResult`
13
+ instead of `ExecutionResult` - the non-"Formatted" versions of these types
14
+ are for use on the server only, but don't get transported over the network.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified. (fixes #11365)
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Allow wrapping `createQueryPreloader`
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ add `ignoreResults` option to `useSubscription`
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending [`@apollo/graphql-testing-library`](https://github.com/apollographql/graphql-testing-library).
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.11.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#11923](https://github.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://github.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for `subscribeToMore` function to `useQueryRefHandlers`.
8
+
9
+ - [#11854](https://github.com/apollographql/apollo-client/pull/11854) [`3812800`](https://github.com/apollographql/apollo-client/commit/3812800c6e4e5e3e64f473543babdba35ce100c2) Thanks [@jcostello-atlassian](https://github.com/jcostello-atlassian)! - Support extensions in useSubscription
10
+
11
+ - [#11923](https://github.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://github.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for `subscribeToMore` function to `useLoadableQuery`.
12
+
13
+ - [#11863](https://github.com/apollographql/apollo-client/pull/11863) [`98e44f7`](https://github.com/apollographql/apollo-client/commit/98e44f74cb7c7e93a81bdc7492c9218bf4a2dcd4) Thanks [@phryneas](https://github.com/phryneas)! - Reimplement `useSubscription` to fix rules of React violations.
14
+
15
+ - [#11869](https://github.com/apollographql/apollo-client/pull/11869) [`a69327c`](https://github.com/apollographql/apollo-client/commit/a69327cce1b36e8855258e9b19427511e0af8748) Thanks [@phryneas](https://github.com/phryneas)! - Rewrite big parts of `useQuery` and `useLazyQuery` to be more compliant with the Rules of React and React Compiler
16
+
17
+ - [#11936](https://github.com/apollographql/apollo-client/pull/11936) [`1b23337`](https://github.com/apollographql/apollo-client/commit/1b23337e5a9eec4ce3ed69531ca4f4afe8e897a6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the `connectToDevtools` option in favor of a new `devtools` configuration.
18
+
19
+ ```ts
20
+ new ApolloClient({
21
+ devtools: {
22
+ enabled: true,
23
+ name: "Test Client",
24
+ },
25
+ });
26
+ ```
27
+
28
+ This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
29
+
30
+ - [#11923](https://github.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://github.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for `subscribeToMore` function to `useBackgroundQuery`.
31
+
32
+ - [#11789](https://github.com/apollographql/apollo-client/pull/11789) [`5793301`](https://github.com/apollographql/apollo-client/commit/579330147d6bd6f7167a35413a33746103e375cb) Thanks [@phryneas](https://github.com/phryneas)! - Changes usages of the `GraphQLError` type to `GraphQLFormattedError`.
33
+
34
+ This was a type bug - these errors were never `GraphQLError` instances
35
+ to begin with, and the `GraphQLError` class has additional properties that can
36
+ never be correctly rehydrated from a GraphQL result.
37
+ The correct type to use here is `GraphQLFormattedError`.
38
+
39
+ Similarly, please ensure to use the type `FormattedExecutionResult`
40
+ instead of `ExecutionResult` - the non-"Formatted" versions of these types
41
+ are for use on the server only, but don't get transported over the network.
42
+
43
+ - [#11930](https://github.com/apollographql/apollo-client/pull/11930) [`a768575`](https://github.com/apollographql/apollo-client/commit/a768575ac1454587208aad63abc811b6a966fe72) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending [`@apollo/graphql-testing-library`](https://github.com/apollographql/graphql-testing-library).
44
+
45
+ ### Patch Changes
46
+
47
+ - [#11927](https://github.com/apollographql/apollo-client/pull/11927) [`2941824`](https://github.com/apollographql/apollo-client/commit/2941824dd66cdd20eee5f2293373ad7a9cf991a4) Thanks [@phryneas](https://github.com/phryneas)! - Add `restart` function to `useSubscription`.
48
+
49
+ - [#11902](https://github.com/apollographql/apollo-client/pull/11902) [`96422ce`](https://github.com/apollographql/apollo-client/commit/96422ce95b923b560321a88acd2eec35cf2a1c18) Thanks [@phryneas](https://github.com/phryneas)! - Add `cause` field to `ApolloError`.
50
+
51
+ - [#11806](https://github.com/apollographql/apollo-client/pull/11806) [`8df6013`](https://github.com/apollographql/apollo-client/commit/8df6013b6b45452ec058fab3e068b5b6d6c493f7) Thanks [@phryneas](https://github.com/phryneas)! - MockLink: add query default variables if not specified in mock request
52
+
53
+ - [#11626](https://github.com/apollographql/apollo-client/pull/11626) [`228429a`](https://github.com/apollographql/apollo-client/commit/228429a1d36eae691473b24fb641ec3cd84c8a3d) Thanks [@phryneas](https://github.com/phryneas)! - Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified. (fixes #11365)
54
+
55
+ - [#11719](https://github.com/apollographql/apollo-client/pull/11719) [`09a6677`](https://github.com/apollographql/apollo-client/commit/09a6677ec1a0cffedeecb2cbac5cd3a3c8aa0fa1) Thanks [@phryneas](https://github.com/phryneas)! - Allow wrapping `createQueryPreloader`
56
+
57
+ - [#11921](https://github.com/apollographql/apollo-client/pull/11921) [`70406bf`](https://github.com/apollographql/apollo-client/commit/70406bfd2b9a645d781638569853d9b435e047df) Thanks [@phryneas](https://github.com/phryneas)! - add `ignoreResults` option to `useSubscription`
58
+
59
+ ## 3.10.8
60
+
61
+ ### Patch Changes
62
+
63
+ - [#11911](https://github.com/apollographql/apollo-client/pull/11911) [`1f0460a`](https://github.com/apollographql/apollo-client/commit/1f0460a60fc613e8d6f218a74ded69e81e960791) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow `undefined` to be returned from a `cache.modify` modifier function when a generic type argument is used.
64
+
3
65
  ## 3.10.7
4
66
 
5
67
  ### Patch Changes
@@ -451,7 +513,7 @@
451
513
  import { Environment, Network, RecordSource, Store } from "relay-runtime";
452
514
 
453
515
  const fetchMultipartSubs = createFetchMultipartSubscription(
454
- "http://localhost:4000",
516
+ "http://localhost:4000"
455
517
  );
456
518
 
457
519
  const network = Network.create(fetchQuery, fetchMultipartSubs);
@@ -804,7 +866,7 @@
804
866
  return data.breeds.map(({ characteristics }) =>
805
867
  characteristics.map((characteristic) => (
806
868
  <div key={characteristic}>{characteristic}</div>
807
- )),
869
+ ))
808
870
  );
809
871
  }
810
872
  ```
@@ -855,7 +917,7 @@
855
917
 
856
918
  const { data } = useSuspenseQuery(
857
919
  query,
858
- id ? { variables: { id } } : skipToken,
920
+ id ? { variables: { id } } : skipToken
859
921
  );
860
922
  ```
861
923
 
@@ -2810,7 +2872,7 @@ In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling o
2810
2872
  fields: {
2811
2873
  comments(comments: Reference[], { readField }) {
2812
2874
  return comments.filter(
2813
- (comment) => idToRemove !== readField("id", comment),
2875
+ (comment) => idToRemove !== readField("id", comment)
2814
2876
  );
2815
2877
  },
2816
2878
  },