@apollo/client 3.11.0-rc.2 → 3.11.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.
- package/CHANGELOG.md +107 -0
- package/README.md +7 -0
- package/apollo-client.cjs +32 -34
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/config/jest/setup.js +2 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.js +31 -33
- package/core/ApolloClient.js.map +1 -1
- package/core/core.cjs +32 -34
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +32 -34
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +15 -15
- package/react/internal/internal.cjs +1 -1
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/version.js +1 -1
- package/.changeset/angry-ravens-mate.md +0 -5
- package/.changeset/angry-seals-jog.md +0 -5
- package/.changeset/breezy-deers-dream.md +0 -5
- package/.changeset/chilly-dots-shake.md +0 -5
- package/.changeset/clever-bikes-admire.md +0 -5
- package/.changeset/curly-vans-draw.md +0 -5
- package/.changeset/early-tips-vanish.md +0 -5
- package/.changeset/flat-onions-guess.md +0 -5
- package/.changeset/fluffy-badgers-rush.md +0 -5
- package/.changeset/good-suns-happen.md +0 -5
- package/.changeset/hungry-rings-help.md +0 -5
- package/.changeset/little-suits-return.md +0 -5
- package/.changeset/nasty-olives-act.md +0 -5
- package/.changeset/pink-ants-remember.md +0 -16
- package/.changeset/pink-flowers-switch.md +0 -5
- package/.changeset/pre.json +0 -31
- package/.changeset/proud-humans-begin.md +0 -5
- package/.changeset/slimy-balloons-cheat.md +0 -5
- package/.changeset/slimy-berries-yawn.md +0 -14
- package/.changeset/tasty-chairs-dress.md +0 -5
- package/.changeset/thin-lies-begin.md +0 -5
- package/.changeset/unlucky-birds-press.md +0 -5
- package/.changeset/weak-ads-develop.md +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11969](https://github.com/apollographql/apollo-client/pull/11969) [`061cab6`](https://github.com/apollographql/apollo-client/commit/061cab6627abd4ec81f83c40c1d281c418627c93) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove check for `window.__APOLLO_CLIENT__` when determining whether to connect to Apollo Client Devtools when `connectToDevtools` or `devtools.enabled` is not specified. This now simply checks to see if the application is in development mode.
|
|
8
|
+
|
|
9
|
+
- [#11971](https://github.com/apollographql/apollo-client/pull/11971) [`ecf77f6`](https://github.com/apollographql/apollo-client/commit/ecf77f6f5b5ccf64cfba51e838e96549fb6c92fe) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent the `setTimeout` for suggesting devtools from running in non-browser environments.
|
|
10
|
+
|
|
11
|
+
## 3.11.0
|
|
12
|
+
|
|
13
|
+
### Potentially Breaking Fixes
|
|
14
|
+
|
|
15
|
+
- [#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`.
|
|
16
|
+
|
|
17
|
+
This was a type bug - these errors were never `GraphQLError` instances
|
|
18
|
+
to begin with, and the `GraphQLError` class has additional properties that can
|
|
19
|
+
never be correctly rehydrated from a GraphQL result.
|
|
20
|
+
The correct type to use here is `GraphQLFormattedError`.
|
|
21
|
+
|
|
22
|
+
Similarly, please ensure to use the type `FormattedExecutionResult`
|
|
23
|
+
instead of `ExecutionResult` - the non-"Formatted" versions of these types
|
|
24
|
+
are for use on the server only, but don't get transported over the network.
|
|
25
|
+
|
|
26
|
+
- [#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.
|
|
27
|
+
|
|
28
|
+
Previously this would only be called when the current `fetchPolicy` was equal to the `fetchPolicy` option or the option was not specified. If you use `nextFetchPolicy` as a function, expect to see this function called more often.
|
|
29
|
+
|
|
30
|
+
Due to this bug, this also meant that the `fetchPolicy` might be reset to the initial `fetchPolicy`, even when you specified a `nextFetchPolicy` function. If you previously relied on this behavior, you will need to update your `nextFetchPolicy` callback function to implement this resetting behavior.
|
|
31
|
+
|
|
32
|
+
As an example, if your code looked like the following:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
useQuery(QUERY, {
|
|
36
|
+
nextFetchPolicy(currentFetchPolicy, info) {
|
|
37
|
+
// your logic here
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Update your function to the following to reimplement the resetting behavior:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
useQuery(QUERY, {
|
|
46
|
+
nextFetchPolicy(currentFetchPolicy, info) {
|
|
47
|
+
if (info.reason === 'variables-changed') {
|
|
48
|
+
return info.initialFetchPolicy;
|
|
49
|
+
}
|
|
50
|
+
// your logic here
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- [#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`.
|
|
58
|
+
|
|
59
|
+
- [#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
|
|
60
|
+
|
|
61
|
+
- [#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`.
|
|
62
|
+
|
|
63
|
+
- [#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.
|
|
64
|
+
|
|
65
|
+
- [#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
|
|
66
|
+
|
|
67
|
+
- [#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.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
new ApolloClient({
|
|
71
|
+
devtools: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
name: "Test Client",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
|
|
79
|
+
|
|
80
|
+
- [#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`.
|
|
81
|
+
|
|
82
|
+
- [#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).
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- [#11951](https://github.com/apollographql/apollo-client/pull/11951) [`0de03af`](https://github.com/apollographql/apollo-client/commit/0de03af912a76c4e0111f21b4f90a073317b63b6) Thanks [@phryneas](https://github.com/phryneas)! - add React 19 RC to `peerDependencies`
|
|
87
|
+
|
|
88
|
+
- [#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`.
|
|
89
|
+
|
|
90
|
+
- [#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`
|
|
91
|
+
|
|
92
|
+
- [#11937](https://github.com/apollographql/apollo-client/pull/11937) [`78332be`](https://github.com/apollographql/apollo-client/commit/78332be32a9af0da33eb3e4100e7a76c3eac2496) Thanks [@phryneas](https://github.com/phryneas)! - `createSchemaFetch`: simulate serialized errors instead of an `ApolloError` instance
|
|
93
|
+
|
|
94
|
+
- [#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`.
|
|
95
|
+
|
|
96
|
+
- [#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
|
|
97
|
+
|
|
98
|
+
- [#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`
|
|
99
|
+
|
|
100
|
+
- [#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.
|
|
101
|
+
|
|
102
|
+
- [#11944](https://github.com/apollographql/apollo-client/pull/11944) [`8f3d7eb`](https://github.com/apollographql/apollo-client/commit/8f3d7eb3bc2e0c2d79c5b1856655abe829390742) Thanks [@sneyderdev](https://github.com/sneyderdev)! - Allow `IgnoreModifier` to be returned from a `optimisticResponse` function when inferring from a `TypedDocumentNode` when used with a generic argument.
|
|
103
|
+
|
|
104
|
+
- [#11954](https://github.com/apollographql/apollo-client/pull/11954) [`4a6e86a`](https://github.com/apollographql/apollo-client/commit/4a6e86aeaf6685abf0dd23110784848c8b085735) Thanks [@phryneas](https://github.com/phryneas)! - Document (and deprecate) the previously undocumented `errors` property on the `useQuery` `QueryResult` type.
|
|
105
|
+
|
|
106
|
+
- [#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`
|
|
107
|
+
|
|
108
|
+
- [#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`
|
|
109
|
+
|
|
3
110
|
## 3.11.0-rc.2
|
|
4
111
|
|
|
5
112
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
**Announcement:**
|
|
15
|
+
Join 1000+ engineers at GraphQL Summit for talks, workshops, and office hours, Oct 8-10 in NYC. [Get your pass here ->](https://summit.graphql.com/?utm_campaign=github_federation_readme)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
12
19
|
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components that fetch data via GraphQL.
|
|
13
20
|
|
|
14
21
|
| ☑️ Apollo Client User Survey |
|
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.11.
|
|
34
|
+
var version = "3.11.1";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -6977,10 +6977,7 @@ var ApolloClient = (function () {
|
|
|
6977
6977
|
this.typeDefs = typeDefs;
|
|
6978
6978
|
this.devtoolsConfig = tslib.__assign(tslib.__assign({}, devtools), { enabled: (devtools === null || devtools === void 0 ? void 0 : devtools.enabled) || connectToDevTools });
|
|
6979
6979
|
if (this.devtoolsConfig.enabled === undefined) {
|
|
6980
|
-
this.devtoolsConfig.enabled =
|
|
6981
|
-
typeof window === "object" &&
|
|
6982
|
-
window.__APOLLO_CLIENT__ &&
|
|
6983
|
-
globalThis.__DEV__ !== false;
|
|
6980
|
+
this.devtoolsConfig.enabled = globalThis.__DEV__ !== false;
|
|
6984
6981
|
}
|
|
6985
6982
|
if (ssrForceFetchDelay) {
|
|
6986
6983
|
setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay);
|
|
@@ -7031,41 +7028,42 @@ var ApolloClient = (function () {
|
|
|
7031
7028
|
this.connectToDevTools();
|
|
7032
7029
|
}
|
|
7033
7030
|
ApolloClient.prototype.connectToDevTools = function () {
|
|
7034
|
-
if (typeof window === "
|
|
7035
|
-
|
|
7036
|
-
var devtoolsSymbol = Symbol.for("apollo.devtools");
|
|
7037
|
-
(windowWithDevTools[devtoolsSymbol] =
|
|
7038
|
-
windowWithDevTools[devtoolsSymbol] || []).push(this);
|
|
7039
|
-
windowWithDevTools.__APOLLO_CLIENT__ = this;
|
|
7031
|
+
if (typeof window === "undefined") {
|
|
7032
|
+
return;
|
|
7040
7033
|
}
|
|
7034
|
+
var windowWithDevTools = window;
|
|
7035
|
+
var devtoolsSymbol = Symbol.for("apollo.devtools");
|
|
7036
|
+
(windowWithDevTools[devtoolsSymbol] =
|
|
7037
|
+
windowWithDevTools[devtoolsSymbol] || []).push(this);
|
|
7038
|
+
windowWithDevTools.__APOLLO_CLIENT__ = this;
|
|
7041
7039
|
if (!hasSuggestedDevtools && globalThis.__DEV__ !== false) {
|
|
7042
7040
|
hasSuggestedDevtools = true;
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7041
|
+
if (window.document &&
|
|
7042
|
+
window.top === window.self &&
|
|
7043
|
+
/^(https?|file):$/.test(window.location.protocol)) {
|
|
7044
|
+
setTimeout(function () {
|
|
7045
|
+
if (!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
|
|
7046
|
+
var nav = window.navigator;
|
|
7047
|
+
var ua = nav && nav.userAgent;
|
|
7048
|
+
var url = void 0;
|
|
7049
|
+
if (typeof ua === "string") {
|
|
7050
|
+
if (ua.indexOf("Chrome/") > -1) {
|
|
7051
|
+
url =
|
|
7052
|
+
"https://chrome.google.com/webstore/detail/" +
|
|
7053
|
+
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
|
|
7054
|
+
}
|
|
7055
|
+
else if (ua.indexOf("Firefox/") > -1) {
|
|
7056
|
+
url =
|
|
7057
|
+
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
|
|
7058
|
+
}
|
|
7057
7059
|
}
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
"
|
|
7060
|
+
if (url) {
|
|
7061
|
+
globalThis.__DEV__ !== false && invariant.log("Download the Apollo DevTools for a better development " +
|
|
7062
|
+
"experience: %s", url);
|
|
7061
7063
|
}
|
|
7062
7064
|
}
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
"experience: %s", url);
|
|
7066
|
-
}
|
|
7067
|
-
}
|
|
7068
|
-
}, 10000);
|
|
7065
|
+
}, 10000);
|
|
7066
|
+
}
|
|
7069
7067
|
}
|
|
7070
7068
|
};
|
|
7071
7069
|
Object.defineProperty(ApolloClient.prototype, "documentTransform", {
|