@apollo/client 3.10.8 → 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 (133) 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 +60 -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/core/ApolloClient.d.ts +24 -2
  22. package/core/ApolloClient.js +9 -8
  23. package/core/ApolloClient.js.map +1 -1
  24. package/core/ObservableQuery.js +5 -1
  25. package/core/ObservableQuery.js.map +1 -1
  26. package/core/QueryInfo.d.ts +2 -2
  27. package/core/QueryInfo.js.map +1 -1
  28. package/core/QueryManager.d.ts +1 -1
  29. package/core/QueryManager.js +5 -4
  30. package/core/QueryManager.js.map +1 -1
  31. package/core/core.cjs +18 -11
  32. package/core/core.cjs.map +1 -1
  33. package/core/core.cjs.native.js +18 -11
  34. package/core/types.d.ts +2 -2
  35. package/core/types.js.map +1 -1
  36. package/core/watchQueryOptions.d.ts +4 -0
  37. package/core/watchQueryOptions.js.map +1 -1
  38. package/dev/dev.cjs +40 -34
  39. package/dev/dev.cjs.map +1 -1
  40. package/dev/dev.cjs.native.js +40 -34
  41. package/errors/errors.cjs +4 -0
  42. package/errors/errors.cjs.map +1 -1
  43. package/errors/errors.cjs.native.js +4 -0
  44. package/errors/index.d.ts +18 -3
  45. package/errors/index.js +7 -2
  46. package/errors/index.js.map +1 -1
  47. package/invariantErrorCodes.js +41 -34
  48. package/link/core/types.d.ts +6 -4
  49. package/link/core/types.js.map +1 -1
  50. package/link/error/index.d.ts +4 -4
  51. package/link/error/index.js.map +1 -1
  52. package/link/persisted-queries/index.d.ts +3 -3
  53. package/link/persisted-queries/index.js.map +1 -1
  54. package/link/subscriptions/index.js +1 -0
  55. package/link/subscriptions/index.js.map +1 -1
  56. package/link/subscriptions/subscriptions.cjs.map +1 -1
  57. package/package.json +29 -29
  58. package/react/hooks/hooks.cjs +445 -368
  59. package/react/hooks/hooks.cjs.map +1 -1
  60. package/react/hooks/hooks.cjs.native.js +445 -368
  61. package/react/hooks/internal/wrapHook.d.ts +2 -0
  62. package/react/hooks/internal/wrapHook.js.map +1 -1
  63. package/react/hooks/useBackgroundQuery.d.ts +15 -1
  64. package/react/hooks/useBackgroundQuery.js +5 -1
  65. package/react/hooks/useBackgroundQuery.js.map +1 -1
  66. package/react/hooks/useLazyQuery.js +54 -12
  67. package/react/hooks/useLazyQuery.js.map +1 -1
  68. package/react/hooks/useLoadableQuery.d.ts +7 -1
  69. package/react/hooks/useLoadableQuery.js +5 -1
  70. package/react/hooks/useLoadableQuery.js.map +1 -1
  71. package/react/hooks/useQuery.d.ts +34 -47
  72. package/react/hooks/useQuery.js +387 -388
  73. package/react/hooks/useQuery.js.map +1 -1
  74. package/react/hooks/useQueryRefHandlers.d.ts +7 -1
  75. package/react/hooks/useQueryRefHandlers.js +5 -1
  76. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  77. package/react/hooks/useSubscription.d.ts +13 -10
  78. package/react/hooks/useSubscription.js +130 -98
  79. package/react/hooks/useSubscription.js.map +1 -1
  80. package/react/hooks/useSuspenseQuery.js +3 -3
  81. package/react/hooks/useSuspenseQuery.js.map +1 -1
  82. package/react/hooks/useSyncExternalStore.js +1 -1
  83. package/react/internal/cache/QueryReference.js +1 -1
  84. package/react/internal/internal.cjs +2 -2
  85. package/react/internal/internal.cjs.map +1 -1
  86. package/react/internal/internal.cjs.native.js +2 -2
  87. package/react/parser/index.js +5 -5
  88. package/react/parser/parser.cjs +5 -5
  89. package/react/parser/parser.cjs.map +1 -1
  90. package/react/parser/parser.cjs.native.js +5 -5
  91. package/react/query-preloader/createQueryPreloader.js +5 -1
  92. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  93. package/react/react.cjs +12 -1
  94. package/react/react.cjs.map +1 -1
  95. package/react/react.cjs.native.js +12 -1
  96. package/react/types/types.d.ts +19 -0
  97. package/react/types/types.documentation.d.ts +10 -0
  98. package/react/types/types.documentation.js.map +1 -1
  99. package/react/types/types.js.map +1 -1
  100. package/testing/core/core.cjs +6 -5
  101. package/testing/core/core.cjs.map +1 -1
  102. package/testing/core/core.cjs.native.js +6 -5
  103. package/testing/core/mocking/mockLink.js +8 -7
  104. package/testing/core/mocking/mockLink.js.map +1 -1
  105. package/testing/experimental/createSchemaFetch.d.ts +2 -0
  106. package/testing/experimental/createSchemaFetch.js +12 -1
  107. package/testing/experimental/createSchemaFetch.js.map +1 -1
  108. package/testing/experimental/createTestSchema.d.ts +2 -0
  109. package/testing/experimental/createTestSchema.js +2 -0
  110. package/testing/experimental/createTestSchema.js.map +1 -1
  111. package/testing/experimental/experimental.cjs +5 -1
  112. package/testing/experimental/experimental.cjs.map +1 -1
  113. package/testing/experimental/experimental.cjs.native.js +5 -1
  114. package/testing/internal/disposables/enableFakeTimers.d.ts +7 -0
  115. package/testing/internal/disposables/enableFakeTimers.js +16 -0
  116. package/testing/internal/disposables/enableFakeTimers.js.map +1 -0
  117. package/testing/internal/disposables/index.d.ts +1 -0
  118. package/testing/internal/disposables/index.js +1 -0
  119. package/testing/internal/disposables/index.js.map +1 -1
  120. package/utilities/common/errorHandling.d.ts +1 -1
  121. package/utilities/globals/globals.cjs +1 -1
  122. package/utilities/globals/globals.cjs.map +1 -1
  123. package/utilities/globals/globals.cjs.native.js +1 -1
  124. package/utilities/graphql/DocumentTransform.js +1 -1
  125. package/utilities/graphql/directives.js +4 -4
  126. package/utilities/graphql/fragments.js +3 -3
  127. package/utilities/graphql/getFromAST.js +8 -8
  128. package/utilities/graphql/storeUtils.js +1 -1
  129. package/utilities/graphql/transform.js +2 -2
  130. package/utilities/utilities.cjs +19 -19
  131. package/utilities/utilities.cjs.map +1 -1
  132. package/utilities/utilities.cjs.native.js +19 -19
  133. 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,61 @@
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
+
3
59
  ## 3.10.8
4
60
 
5
61
  ### Patch Changes
@@ -457,7 +513,7 @@
457
513
  import { Environment, Network, RecordSource, Store } from "relay-runtime";
458
514
 
459
515
  const fetchMultipartSubs = createFetchMultipartSubscription(
460
- "http://localhost:4000",
516
+ "http://localhost:4000"
461
517
  );
462
518
 
463
519
  const network = Network.create(fetchQuery, fetchMultipartSubs);
@@ -810,7 +866,7 @@
810
866
  return data.breeds.map(({ characteristics }) =>
811
867
  characteristics.map((characteristic) => (
812
868
  <div key={characteristic}>{characteristic}</div>
813
- )),
869
+ ))
814
870
  );
815
871
  }
816
872
  ```
@@ -861,7 +917,7 @@
861
917
 
862
918
  const { data } = useSuspenseQuery(
863
919
  query,
864
- id ? { variables: { id } } : skipToken,
920
+ id ? { variables: { id } } : skipToken
865
921
  );
866
922
  ```
867
923
 
@@ -2816,7 +2872,7 @@ In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling o
2816
2872
  fields: {
2817
2873
  comments(comments: Reference[], { readField }) {
2818
2874
  return comments.filter(
2819
- (comment) => idToRemove !== readField("id", comment),
2875
+ (comment) => idToRemove !== readField("id", comment)
2820
2876
  );
2821
2877
  },
2822
2878
  },