@apollo/client 3.10.8 → 3.11.0-rc.1

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 (142) 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/curly-vans-draw.md +5 -0
  6. package/.changeset/flat-onions-guess.md +5 -0
  7. package/.changeset/fluffy-badgers-rush.md +5 -0
  8. package/.changeset/good-suns-happen.md +5 -0
  9. package/.changeset/hungry-rings-help.md +5 -0
  10. package/.changeset/little-suits-return.md +5 -0
  11. package/.changeset/nasty-olives-act.md +5 -0
  12. package/.changeset/pink-ants-remember.md +16 -0
  13. package/.changeset/pre.json +27 -0
  14. package/.changeset/slimy-balloons-cheat.md +5 -0
  15. package/.changeset/slimy-berries-yawn.md +14 -0
  16. package/.changeset/tasty-chairs-dress.md +5 -0
  17. package/.changeset/thin-lies-begin.md +5 -0
  18. package/.changeset/unlucky-birds-press.md +5 -0
  19. package/.changeset/weak-ads-develop.md +5 -0
  20. package/CHANGELOG.md +70 -4
  21. package/apollo-client.cjs +504 -418
  22. package/apollo-client.cjs.map +1 -1
  23. package/apollo-client.min.cjs +1 -1
  24. package/cache/cache.cjs +2 -7
  25. package/cache/cache.cjs.map +1 -1
  26. package/cache/cache.cjs.native.js +2 -7
  27. package/cache/core/cache.d.ts +0 -11
  28. package/cache/core/cache.js +2 -7
  29. package/cache/core/cache.js.map +1 -1
  30. package/core/ApolloClient.d.ts +24 -2
  31. package/core/ApolloClient.js +10 -9
  32. package/core/ApolloClient.js.map +1 -1
  33. package/core/ObservableQuery.js +5 -1
  34. package/core/ObservableQuery.js.map +1 -1
  35. package/core/QueryInfo.d.ts +2 -2
  36. package/core/QueryInfo.js.map +1 -1
  37. package/core/QueryManager.d.ts +1 -1
  38. package/core/QueryManager.js +5 -4
  39. package/core/QueryManager.js.map +1 -1
  40. package/core/core.cjs +19 -12
  41. package/core/core.cjs.map +1 -1
  42. package/core/core.cjs.native.js +19 -12
  43. package/core/types.d.ts +2 -2
  44. package/core/types.js.map +1 -1
  45. package/core/watchQueryOptions.d.ts +4 -0
  46. package/core/watchQueryOptions.js.map +1 -1
  47. package/dev/dev.cjs +40 -34
  48. package/dev/dev.cjs.map +1 -1
  49. package/dev/dev.cjs.native.js +40 -34
  50. package/errors/errors.cjs +4 -0
  51. package/errors/errors.cjs.map +1 -1
  52. package/errors/errors.cjs.native.js +4 -0
  53. package/errors/index.d.ts +18 -3
  54. package/errors/index.js +7 -2
  55. package/errors/index.js.map +1 -1
  56. package/invariantErrorCodes.js +41 -34
  57. package/link/core/types.d.ts +6 -4
  58. package/link/core/types.js.map +1 -1
  59. package/link/error/index.d.ts +4 -4
  60. package/link/error/index.js.map +1 -1
  61. package/link/persisted-queries/index.d.ts +3 -3
  62. package/link/persisted-queries/index.js.map +1 -1
  63. package/link/subscriptions/index.js +1 -0
  64. package/link/subscriptions/index.js.map +1 -1
  65. package/link/subscriptions/subscriptions.cjs.map +1 -1
  66. package/package.json +29 -29
  67. package/react/hooks/hooks.cjs +445 -368
  68. package/react/hooks/hooks.cjs.map +1 -1
  69. package/react/hooks/hooks.cjs.native.js +445 -368
  70. package/react/hooks/internal/wrapHook.d.ts +2 -0
  71. package/react/hooks/internal/wrapHook.js.map +1 -1
  72. package/react/hooks/useBackgroundQuery.d.ts +15 -1
  73. package/react/hooks/useBackgroundQuery.js +5 -1
  74. package/react/hooks/useBackgroundQuery.js.map +1 -1
  75. package/react/hooks/useLazyQuery.js +54 -12
  76. package/react/hooks/useLazyQuery.js.map +1 -1
  77. package/react/hooks/useLoadableQuery.d.ts +7 -1
  78. package/react/hooks/useLoadableQuery.js +5 -1
  79. package/react/hooks/useLoadableQuery.js.map +1 -1
  80. package/react/hooks/useQuery.d.ts +34 -47
  81. package/react/hooks/useQuery.js +387 -388
  82. package/react/hooks/useQuery.js.map +1 -1
  83. package/react/hooks/useQueryRefHandlers.d.ts +7 -1
  84. package/react/hooks/useQueryRefHandlers.js +5 -1
  85. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  86. package/react/hooks/useSubscription.d.ts +13 -10
  87. package/react/hooks/useSubscription.js +130 -98
  88. package/react/hooks/useSubscription.js.map +1 -1
  89. package/react/hooks/useSuspenseQuery.js +3 -3
  90. package/react/hooks/useSuspenseQuery.js.map +1 -1
  91. package/react/hooks/useSyncExternalStore.js +1 -1
  92. package/react/internal/cache/QueryReference.js +1 -1
  93. package/react/internal/internal.cjs +2 -2
  94. package/react/internal/internal.cjs.map +1 -1
  95. package/react/internal/internal.cjs.native.js +2 -2
  96. package/react/parser/index.js +5 -5
  97. package/react/parser/parser.cjs +5 -5
  98. package/react/parser/parser.cjs.map +1 -1
  99. package/react/parser/parser.cjs.native.js +5 -5
  100. package/react/query-preloader/createQueryPreloader.js +5 -1
  101. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  102. package/react/react.cjs +12 -1
  103. package/react/react.cjs.map +1 -1
  104. package/react/react.cjs.native.js +12 -1
  105. package/react/types/types.d.ts +19 -0
  106. package/react/types/types.documentation.d.ts +10 -0
  107. package/react/types/types.documentation.js.map +1 -1
  108. package/react/types/types.js.map +1 -1
  109. package/testing/core/core.cjs +6 -5
  110. package/testing/core/core.cjs.map +1 -1
  111. package/testing/core/core.cjs.native.js +6 -5
  112. package/testing/core/mocking/mockLink.js +8 -7
  113. package/testing/core/mocking/mockLink.js.map +1 -1
  114. package/testing/experimental/createSchemaFetch.d.ts +2 -0
  115. package/testing/experimental/createSchemaFetch.js +12 -1
  116. package/testing/experimental/createSchemaFetch.js.map +1 -1
  117. package/testing/experimental/createTestSchema.d.ts +2 -0
  118. package/testing/experimental/createTestSchema.js +2 -0
  119. package/testing/experimental/createTestSchema.js.map +1 -1
  120. package/testing/experimental/experimental.cjs +5 -1
  121. package/testing/experimental/experimental.cjs.map +1 -1
  122. package/testing/experimental/experimental.cjs.native.js +5 -1
  123. package/testing/internal/disposables/enableFakeTimers.d.ts +7 -0
  124. package/testing/internal/disposables/enableFakeTimers.js +16 -0
  125. package/testing/internal/disposables/enableFakeTimers.js.map +1 -0
  126. package/testing/internal/disposables/index.d.ts +1 -0
  127. package/testing/internal/disposables/index.js +1 -0
  128. package/testing/internal/disposables/index.js.map +1 -1
  129. package/utilities/common/errorHandling.d.ts +1 -1
  130. package/utilities/globals/globals.cjs +1 -1
  131. package/utilities/globals/globals.cjs.map +1 -1
  132. package/utilities/globals/globals.cjs.native.js +1 -1
  133. package/utilities/graphql/DocumentTransform.js +1 -1
  134. package/utilities/graphql/directives.js +4 -4
  135. package/utilities/graphql/fragments.js +3 -3
  136. package/utilities/graphql/getFromAST.js +8 -8
  137. package/utilities/graphql/storeUtils.js +1 -1
  138. package/utilities/graphql/transform.js +2 -2
  139. package/utilities/utilities.cjs +19 -19
  140. package/utilities/utilities.cjs.map +1 -1
  141. package/utilities/utilities.cjs.native.js +19 -19
  142. 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
+ Remove deprecated `watchFragment` option, `canonizeResults`
@@ -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": patch
3
+ ---
4
+
5
+ `watchFragment`: forward additional options to `diffOptions`
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ Fix issue where mutations were not accessible by Apollo Client Devtools in 3.11.0-rc.0.
@@ -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,27 @@
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
+ "curly-vans-draw",
13
+ "flat-onions-guess",
14
+ "fluffy-badgers-rush",
15
+ "good-suns-happen",
16
+ "hungry-rings-help",
17
+ "little-suits-return",
18
+ "nasty-olives-act",
19
+ "pink-ants-remember",
20
+ "slimy-balloons-cheat",
21
+ "slimy-berries-yawn",
22
+ "tasty-chairs-dress",
23
+ "thin-lies-begin",
24
+ "unlucky-birds-press",
25
+ "weak-ads-develop"
26
+ ]
27
+ }
@@ -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,71 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.11.0-rc.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#11949](https://github.com/apollographql/apollo-client/pull/11949) [`4528918`](https://github.com/apollographql/apollo-client/commit/45289186bcaaa33dfe904913eb6df31e2541c219) Thanks [@alessbell](https://github.com/alessbell)! - Remove deprecated `watchFragment` option, `canonizeResults`
8
+
9
+ - [#11926](https://github.com/apollographql/apollo-client/pull/11926) [`3dd6432`](https://github.com/apollographql/apollo-client/commit/3dd64324dc5156450cead27f8141ea93315ffe65) Thanks [@phryneas](https://github.com/phryneas)! - `watchFragment`: forward additional options to `diffOptions`
10
+
11
+ - [#11946](https://github.com/apollographql/apollo-client/pull/11946) [`7d833b8`](https://github.com/apollographql/apollo-client/commit/7d833b80119a991e6d2eb58f2c71074d697b8e63) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where mutations were not accessible by Apollo Client Devtools in 3.11.0-rc.0.
12
+
13
+ ## 3.11.0-rc.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#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`.
18
+
19
+ - [#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
20
+
21
+ - [#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`.
22
+
23
+ - [#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.
24
+
25
+ - [#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
26
+
27
+ - [#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.
28
+
29
+ ```ts
30
+ new ApolloClient({
31
+ devtools: {
32
+ enabled: true,
33
+ name: "Test Client",
34
+ },
35
+ });
36
+ ```
37
+
38
+ This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
39
+
40
+ - [#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`.
41
+
42
+ - [#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`.
43
+
44
+ This was a type bug - these errors were never `GraphQLError` instances
45
+ to begin with, and the `GraphQLError` class has additional properties that can
46
+ never be correctly rehydrated from a GraphQL result.
47
+ The correct type to use here is `GraphQLFormattedError`.
48
+
49
+ Similarly, please ensure to use the type `FormattedExecutionResult`
50
+ instead of `ExecutionResult` - the non-"Formatted" versions of these types
51
+ are for use on the server only, but don't get transported over the network.
52
+
53
+ - [#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).
54
+
55
+ ### Patch Changes
56
+
57
+ - [#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`.
58
+
59
+ - [#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`.
60
+
61
+ - [#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
62
+
63
+ - [#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)
64
+
65
+ - [#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`
66
+
67
+ - [#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`
68
+
3
69
  ## 3.10.8
4
70
 
5
71
  ### Patch Changes
@@ -457,7 +523,7 @@
457
523
  import { Environment, Network, RecordSource, Store } from "relay-runtime";
458
524
 
459
525
  const fetchMultipartSubs = createFetchMultipartSubscription(
460
- "http://localhost:4000",
526
+ "http://localhost:4000"
461
527
  );
462
528
 
463
529
  const network = Network.create(fetchQuery, fetchMultipartSubs);
@@ -810,7 +876,7 @@
810
876
  return data.breeds.map(({ characteristics }) =>
811
877
  characteristics.map((characteristic) => (
812
878
  <div key={characteristic}>{characteristic}</div>
813
- )),
879
+ ))
814
880
  );
815
881
  }
816
882
  ```
@@ -861,7 +927,7 @@
861
927
 
862
928
  const { data } = useSuspenseQuery(
863
929
  query,
864
- id ? { variables: { id } } : skipToken,
930
+ id ? { variables: { id } } : skipToken
865
931
  );
866
932
  ```
867
933
 
@@ -2816,7 +2882,7 @@ In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling o
2816
2882
  fields: {
2817
2883
  comments(comments: Reference[], { readField }) {
2818
2884
  return comments.filter(
2819
- (comment) => idToRemove !== readField("id", comment),
2885
+ (comment) => idToRemove !== readField("id", comment)
2820
2886
  );
2821
2887
  },
2822
2888
  },