@apollo/client 3.10.0-rc.0 → 3.10.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 (81) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/apollo-client.cjs +18 -7
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/index.d.ts +1 -1
  6. package/cache/index.js.map +1 -1
  7. package/core/ApolloClient.js +1 -0
  8. package/core/ApolloClient.js.map +1 -1
  9. package/core/core.cjs +2 -1
  10. package/core/core.cjs.map +1 -1
  11. package/core/core.cjs.native.js +2 -1
  12. package/core/index.d.ts +1 -1
  13. package/core/index.js.map +1 -1
  14. package/dev/dev.cjs +1 -1
  15. package/dev/dev.cjs.map +1 -1
  16. package/dev/dev.cjs.native.js +1 -1
  17. package/package.json +2 -1
  18. package/react/hooks/hooks.cjs +10 -1
  19. package/react/hooks/hooks.cjs.map +1 -1
  20. package/react/hooks/hooks.cjs.native.js +10 -1
  21. package/react/hooks/internal/wrapHook.d.ts +2 -1
  22. package/react/hooks/internal/wrapHook.js.map +1 -1
  23. package/react/hooks/useQueryRefHandlers.js +12 -0
  24. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  25. package/react/hooks/useReadQuery.js +9 -1
  26. package/react/hooks/useReadQuery.js.map +1 -1
  27. package/react/internal/cache/QueryReference.js +6 -5
  28. package/react/internal/cache/QueryReference.js.map +1 -1
  29. package/react/internal/internal.cjs +6 -5
  30. package/react/internal/internal.cjs.map +1 -1
  31. package/react/internal/internal.cjs.native.js +6 -5
  32. package/testing/core/core.cjs +0 -103
  33. package/testing/core/core.cjs.map +1 -1
  34. package/testing/core/core.cjs.native.js +0 -103
  35. package/testing/core/index.d.ts +0 -2
  36. package/testing/core/index.js +0 -2
  37. package/testing/core/index.js.map +1 -1
  38. package/testing/{core/createMockFetch.d.ts → experimental/createSchemaFetch.d.ts} +15 -10
  39. package/testing/experimental/createSchemaFetch.js +99 -0
  40. package/testing/experimental/createSchemaFetch.js.map +1 -0
  41. package/testing/{core/createProxiedSchema.d.ts → experimental/createTestSchema.d.ts} +26 -18
  42. package/testing/{core/createProxiedSchema.js → experimental/createTestSchema.js} +34 -23
  43. package/testing/experimental/createTestSchema.js.map +1 -0
  44. package/testing/experimental/experimental.cjs +274 -0
  45. package/testing/experimental/experimental.cjs.map +1 -0
  46. package/testing/experimental/experimental.cjs.native.js +274 -0
  47. package/testing/{graphql-tools → experimental/graphql-tools}/utils.js +1 -1
  48. package/testing/experimental/graphql-tools/utils.js.map +1 -0
  49. package/testing/experimental/graphql-tools/utils.test.js.map +1 -0
  50. package/testing/experimental/index.d.ts +3 -0
  51. package/testing/experimental/index.js +3 -0
  52. package/testing/experimental/index.js.map +1 -0
  53. package/testing/experimental/package.json +8 -0
  54. package/testing/index.d.ts +0 -1
  55. package/testing/index.js +0 -1
  56. package/testing/index.js.map +1 -1
  57. package/testing/internal/profile/Render.d.ts +1 -102
  58. package/testing/internal/profile/Render.js.map +1 -1
  59. package/testing/internal/profile/profile.js +6 -2
  60. package/testing/internal/profile/profile.js.map +1 -1
  61. package/testing/testing.cjs +0 -134
  62. package/testing/testing.cjs.map +1 -1
  63. package/testing/testing.cjs.native.js +0 -134
  64. package/utilities/globals/globals.cjs +1 -1
  65. package/utilities/globals/globals.cjs.map +1 -1
  66. package/utilities/globals/globals.cjs.native.js +1 -1
  67. package/version.js +1 -1
  68. package/.changeset/chatty-llamas-switch.md +0 -5
  69. package/.changeset/pre.json +0 -14
  70. package/.changeset/stupid-bears-cheat.md +0 -5
  71. package/.changeset/tasty-pillows-ring.md +0 -5
  72. package/.changeset/tiny-bugs-tap.md +0 -5
  73. package/.changeset/twelve-apples-vanish.md +0 -5
  74. package/testing/core/createMockFetch.js +0 -79
  75. package/testing/core/createMockFetch.js.map +0 -1
  76. package/testing/core/createProxiedSchema.js.map +0 -1
  77. package/testing/graphql-tools/utils.js.map +0 -1
  78. package/testing/graphql-tools/utils.test.js.map +0 -1
  79. /package/testing/{graphql-tools → experimental/graphql-tools}/utils.d.ts +0 -0
  80. /package/testing/{graphql-tools → experimental/graphql-tools}/utils.test.d.ts +0 -0
  81. /package/testing/{graphql-tools → experimental/graphql-tools}/utils.test.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#11605](https://github.com/apollographql/apollo-client/pull/11605) [`e2dd4c9`](https://github.com/apollographql/apollo-client/commit/e2dd4c95290cea604b548cc446826d89aafe8e11) Thanks [@alessbell](https://github.com/alessbell)! - Adds `createMockFetch` utility for integration testing that includes the link chain
8
+
9
+ - [#11760](https://github.com/apollographql/apollo-client/pull/11760) [`acd1982`](https://github.com/apollographql/apollo-client/commit/acd1982a59ed66fc44fa9e70b08a31c69dac35a6) Thanks [@alessbell](https://github.com/alessbell)! - `createTestSchema` now uses graphql-tools `mergeResolvers` to merge resolvers instead of a shallow merge.
10
+
11
+ - [#11764](https://github.com/apollographql/apollo-client/pull/11764) [`f046aa9`](https://github.com/apollographql/apollo-client/commit/f046aa9fc24ac197a797045d280811a3bbe05806) Thanks [@alessbell](https://github.com/alessbell)! - Rename `createProxiedSchema` to `createTestSchema` and `createMockFetch` to `createSchemaFetch`.
12
+
13
+ - [#11777](https://github.com/apollographql/apollo-client/pull/11777) [`5dfc79f`](https://github.com/apollographql/apollo-client/commit/5dfc79fa6d974362f38361f7dffbe984a9546377) Thanks [@alessbell](https://github.com/alessbell)! - Call `createMockSchema` inside `createTestSchema`.
14
+
15
+ - [#11774](https://github.com/apollographql/apollo-client/pull/11774) [`2583488`](https://github.com/apollographql/apollo-client/commit/2583488677912cb4500e5fb9e3f91b5c113c4cdb) Thanks [@alessbell](https://github.com/alessbell)! - Add ability to set min and max delay in `createSchemaFetch`
16
+
17
+ - [#11605](https://github.com/apollographql/apollo-client/pull/11605) [`e2dd4c9`](https://github.com/apollographql/apollo-client/commit/e2dd4c95290cea604b548cc446826d89aafe8e11) Thanks [@alessbell](https://github.com/alessbell)! - Adds proxiedSchema and createMockSchema testing utilities
18
+
19
+ - [#11465](https://github.com/apollographql/apollo-client/pull/11465) [`7623da7`](https://github.com/apollographql/apollo-client/commit/7623da7720855b0c19e13ff9124679f426a39725) Thanks [@alessbell](https://github.com/alessbell)! - Add `watchFragment` method to the cache and expose it on ApolloClient, refactor `useFragment` using `watchFragment`.
20
+
21
+ - [#11743](https://github.com/apollographql/apollo-client/pull/11743) [`78891f9`](https://github.com/apollographql/apollo-client/commit/78891f9ec81c0b7a7e010f5550a91965fa33a958) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove alpha designation for `queryRef.toPromise()` to stabilize the API.
22
+
23
+ - [#11743](https://github.com/apollographql/apollo-client/pull/11743) [`78891f9`](https://github.com/apollographql/apollo-client/commit/78891f9ec81c0b7a7e010f5550a91965fa33a958) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove alpha designation for `createQueryPreloader` to stabilize the API.
24
+
25
+ - [#11783](https://github.com/apollographql/apollo-client/pull/11783) [`440563a`](https://github.com/apollographql/apollo-client/commit/440563ab2c47efcb9c7d08f52531ade33d753037) Thanks [@alessbell](https://github.com/alessbell)! - Moves new testing utilities to their own entrypoint, `testing/experimental`
26
+
27
+ ### Patch Changes
28
+
29
+ - [#11757](https://github.com/apollographql/apollo-client/pull/11757) [`9825295`](https://github.com/apollographql/apollo-client/commit/982529530893f66a1d236f0fff53862e513fc9a8) Thanks [@phryneas](https://github.com/phryneas)! - Adjust `useReadQuery` wrapper logic to work with transported objects.
30
+
31
+ - [#11771](https://github.com/apollographql/apollo-client/pull/11771) [`e72cbba`](https://github.com/apollographql/apollo-client/commit/e72cbba07e5caa6d75b44ca8c766846e855a6c93) Thanks [@phryneas](https://github.com/phryneas)! - Wrap `useQueryRefHandlers` in `wrapHook`.
32
+
33
+ - [#11754](https://github.com/apollographql/apollo-client/pull/11754) [`80d2ba5`](https://github.com/apollographql/apollo-client/commit/80d2ba579fe6d2a2d102d1fe79d7d503f31cd931) Thanks [@alessbell](https://github.com/alessbell)! - Export `WatchFragmentOptions` and `WatchFragmentResult` from main entrypoint and fix bug where `this` wasn't bound to the `watchFragment` method on `ApolloClient`.
34
+
35
+ ## 3.10.0-rc.1
36
+
37
+ ### Minor Changes
38
+
39
+ - [#11760](https://github.com/apollographql/apollo-client/pull/11760) [`acd1982`](https://github.com/apollographql/apollo-client/commit/acd1982a59ed66fc44fa9e70b08a31c69dac35a6) Thanks [@alessbell](https://github.com/alessbell)! - `createTestSchema` now uses graphql-tools `mergeResolvers` to merge resolvers instead of a shallow merge.
40
+
41
+ - [#11764](https://github.com/apollographql/apollo-client/pull/11764) [`f046aa9`](https://github.com/apollographql/apollo-client/commit/f046aa9fc24ac197a797045d280811a3bbe05806) Thanks [@alessbell](https://github.com/alessbell)! - Rename `createProxiedSchema` to `createTestSchema` and `createMockFetch` to `createSchemaFetch`.
42
+
43
+ - [#11777](https://github.com/apollographql/apollo-client/pull/11777) [`5dfc79f`](https://github.com/apollographql/apollo-client/commit/5dfc79fa6d974362f38361f7dffbe984a9546377) Thanks [@alessbell](https://github.com/alessbell)! - Call `createMockSchema` inside `createTestSchema`.
44
+
45
+ - [#11774](https://github.com/apollographql/apollo-client/pull/11774) [`2583488`](https://github.com/apollographql/apollo-client/commit/2583488677912cb4500e5fb9e3f91b5c113c4cdb) Thanks [@alessbell](https://github.com/alessbell)! - Add ability to set min and max delay in `createSchemaFetch`
46
+
47
+ - [#11783](https://github.com/apollographql/apollo-client/pull/11783) [`440563a`](https://github.com/apollographql/apollo-client/commit/440563ab2c47efcb9c7d08f52531ade33d753037) Thanks [@alessbell](https://github.com/alessbell)! - Moves new testing utilities to their own entrypoint, `testing/experimental`
48
+
49
+ ### Patch Changes
50
+
51
+ - [#11757](https://github.com/apollographql/apollo-client/pull/11757) [`9825295`](https://github.com/apollographql/apollo-client/commit/982529530893f66a1d236f0fff53862e513fc9a8) Thanks [@phryneas](https://github.com/phryneas)! - Adjust `useReadQuery` wrapper logic to work with transported objects.
52
+
53
+ - [#11771](https://github.com/apollographql/apollo-client/pull/11771) [`e72cbba`](https://github.com/apollographql/apollo-client/commit/e72cbba07e5caa6d75b44ca8c766846e855a6c93) Thanks [@phryneas](https://github.com/phryneas)! - Wrap `useQueryRefHandlers` in `wrapHook`.
54
+
55
+ - [#11754](https://github.com/apollographql/apollo-client/pull/11754) [`80d2ba5`](https://github.com/apollographql/apollo-client/commit/80d2ba579fe6d2a2d102d1fe79d7d503f31cd931) Thanks [@alessbell](https://github.com/alessbell)! - Export `WatchFragmentOptions` and `WatchFragmentResult` from main entrypoint and fix bug where `this` wasn't bound to the `watchFragment` method on `ApolloClient`.
56
+
3
57
  ## 3.10.0-rc.0
4
58
 
5
59
  ### Minor Changes
@@ -18,6 +72,12 @@
18
72
 
19
73
  - [#11465](https://github.com/apollographql/apollo-client/pull/11465) [`7623da7`](https://github.com/apollographql/apollo-client/commit/7623da7720855b0c19e13ff9124679f426a39725) Thanks [@alessbell](https://github.com/alessbell)! - Add `watchFragment` method to the cache and expose it on ApolloClient, refactor `useFragment` using `watchFragment`.
20
74
 
75
+ ## 3.9.11
76
+
77
+ ### Patch Changes
78
+
79
+ - [#11769](https://github.com/apollographql/apollo-client/pull/11769) [`04132af`](https://github.com/apollographql/apollo-client/commit/04132af121c9b48d6e03eb733b9b91f825defbac) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where using `skipToken` or the `skip` option with `useSuspenseQuery` in React's strict mode would perform a network request.
80
+
21
81
  ## 3.9.10
22
82
 
23
83
  ### Patch Changes
package/apollo-client.cjs CHANGED
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
31
31
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
32
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
33
 
34
- var version = "3.10.0-rc.0";
34
+ var version = "3.10.0";
35
35
 
36
36
  function maybe(thunk) {
37
37
  try {
@@ -6968,6 +6968,7 @@ var ApolloClient = (function () {
6968
6968
  this.watchQuery = this.watchQuery.bind(this);
6969
6969
  this.query = this.query.bind(this);
6970
6970
  this.mutate = this.mutate.bind(this);
6971
+ this.watchFragment = this.watchFragment.bind(this);
6971
6972
  this.resetStore = this.resetStore.bind(this);
6972
6973
  this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this);
6973
6974
  this.version = version;
@@ -8188,16 +8189,17 @@ var InternalQueryReference = (function () {
8188
8189
  InternalQueryReference.prototype.reinitialize = function () {
8189
8190
  var observable = this.observable;
8190
8191
  var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;
8192
+ var avoidNetworkRequests = originalFetchPolicy === "no-cache" || originalFetchPolicy === "standby";
8191
8193
  try {
8192
- if (originalFetchPolicy !== "no-cache") {
8193
- observable.resetLastResults();
8194
- observable.silentSetOptions({ fetchPolicy: "cache-first" });
8194
+ if (avoidNetworkRequests) {
8195
+ observable.silentSetOptions({ fetchPolicy: "standby" });
8195
8196
  }
8196
8197
  else {
8197
- observable.silentSetOptions({ fetchPolicy: "standby" });
8198
+ observable.resetLastResults();
8199
+ observable.silentSetOptions({ fetchPolicy: "cache-first" });
8198
8200
  }
8199
8201
  this.subscribeToQuery();
8200
- if (originalFetchPolicy === "no-cache") {
8202
+ if (avoidNetworkRequests) {
8201
8203
  return;
8202
8204
  }
8203
8205
  observable.resetDiff();
@@ -8633,6 +8635,12 @@ function useLoadableQuery(query, options) {
8633
8635
  }
8634
8636
 
8635
8637
  function useQueryRefHandlers(queryRef) {
8638
+ var unwrapped = unwrapQueryRef(queryRef);
8639
+ return wrapHook("useQueryRefHandlers", _useQueryRefHandlers, unwrapped ?
8640
+ unwrapped["observable"]
8641
+ : useApolloClient())(queryRef);
8642
+ }
8643
+ function _useQueryRefHandlers(queryRef) {
8636
8644
  var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];
8637
8645
  var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];
8638
8646
  var internalQueryRef = unwrapQueryRef(queryRef);
@@ -8657,7 +8665,10 @@ function useQueryRefHandlers(queryRef) {
8657
8665
  }
8658
8666
 
8659
8667
  function useReadQuery(queryRef) {
8660
- return wrapHook("useReadQuery", _useReadQuery, unwrapQueryRef(queryRef)["observable"])(queryRef);
8668
+ var unwrapped = unwrapQueryRef(queryRef);
8669
+ return wrapHook("useReadQuery", _useReadQuery, unwrapped ?
8670
+ unwrapped["observable"]
8671
+ : useApolloClient())(queryRef);
8661
8672
  }
8662
8673
  function _useReadQuery(queryRef) {
8663
8674
  var internalQueryRef = React__namespace.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]);