@apollo/client 3.11.0-rc.1 → 3.11.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.
- package/CHANGELOG.md +111 -0
- package/README.md +12 -5
- package/apollo-client.cjs +1391 -1398
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/config/jest/areApolloErrorsEqual.d.ts +3 -0
- package/config/jest/areApolloErrorsEqual.js +23 -0
- package/config/jest/areApolloErrorsEqual.js.map +1 -0
- package/config/jest/areGraphQlErrorsEqual.d.ts +3 -0
- package/config/jest/areGraphQlErrorsEqual.js +7 -0
- package/config/jest/areGraphQlErrorsEqual.js.map +1 -0
- package/config/jest/setup.js +6 -0
- package/config/jest/setup.js.map +1 -1
- package/core/QueryManager.d.ts +15 -14
- package/core/QueryManager.js +12 -13
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +805 -805
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +805 -805
- package/core/watchQueryOptions.d.ts +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +22 -19
- package/react/hooks/hooks.cjs +26 -33
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +26 -33
- package/react/hooks/useQuery.d.ts +2 -5
- package/react/hooks/useQuery.js +42 -53
- package/react/hooks/useQuery.js.map +1 -1
- 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/react/types/types.d.ts +6 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +15 -0
- package/testing/core/mocking/mockQueryManager.js +5 -2
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/experimental/createSchemaFetch.js +5 -12
- package/testing/experimental/createSchemaFetch.js.map +1 -1
- package/testing/experimental/experimental.cjs +3 -5
- package/testing/experimental/experimental.cjs.map +1 -1
- package/testing/experimental/experimental.cjs.native.js +3 -5
- 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/chilly-dots-shake.md +0 -5
- package/.changeset/clever-bikes-admire.md +0 -5
- package/.changeset/curly-vans-draw.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/pre.json +0 -27
- 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,116 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.11.0
|
|
4
|
+
|
|
5
|
+
### Potentially Breaking Fixes
|
|
6
|
+
|
|
7
|
+
- [#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`.
|
|
8
|
+
|
|
9
|
+
This was a type bug - these errors were never `GraphQLError` instances
|
|
10
|
+
to begin with, and the `GraphQLError` class has additional properties that can
|
|
11
|
+
never be correctly rehydrated from a GraphQL result.
|
|
12
|
+
The correct type to use here is `GraphQLFormattedError`.
|
|
13
|
+
|
|
14
|
+
Similarly, please ensure to use the type `FormattedExecutionResult`
|
|
15
|
+
instead of `ExecutionResult` - the non-"Formatted" versions of these types
|
|
16
|
+
are for use on the server only, but don't get transported over the network.
|
|
17
|
+
|
|
18
|
+
- [#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.
|
|
19
|
+
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
As an example, if your code looked like the following:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
useQuery(QUERY, {
|
|
28
|
+
nextFetchPolicy(currentFetchPolicy, info) {
|
|
29
|
+
// your logic here
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Update your function to the following to reimplement the resetting behavior:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
useQuery(QUERY, {
|
|
38
|
+
nextFetchPolicy(currentFetchPolicy, info) {
|
|
39
|
+
if (info.reason === 'variables-changed') {
|
|
40
|
+
return info.initialFetchPolicy;
|
|
41
|
+
}
|
|
42
|
+
// your logic here
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- [#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`.
|
|
50
|
+
|
|
51
|
+
- [#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
|
|
52
|
+
|
|
53
|
+
- [#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`.
|
|
54
|
+
|
|
55
|
+
- [#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.
|
|
56
|
+
|
|
57
|
+
- [#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
|
|
58
|
+
|
|
59
|
+
- [#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.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
new ApolloClient({
|
|
63
|
+
devtools: {
|
|
64
|
+
enabled: true,
|
|
65
|
+
name: "Test Client",
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
|
|
71
|
+
|
|
72
|
+
- [#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`.
|
|
73
|
+
|
|
74
|
+
- [#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).
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- [#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`
|
|
79
|
+
|
|
80
|
+
- [#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`.
|
|
81
|
+
|
|
82
|
+
- [#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`
|
|
83
|
+
|
|
84
|
+
- [#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
|
|
85
|
+
|
|
86
|
+
- [#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`.
|
|
87
|
+
|
|
88
|
+
- [#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
|
|
89
|
+
|
|
90
|
+
- [#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`
|
|
91
|
+
|
|
92
|
+
- [#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.
|
|
93
|
+
|
|
94
|
+
- [#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.
|
|
95
|
+
|
|
96
|
+
- [#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.
|
|
97
|
+
|
|
98
|
+
- [#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`
|
|
99
|
+
|
|
100
|
+
- [#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`
|
|
101
|
+
|
|
102
|
+
## 3.11.0-rc.2
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- [#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`
|
|
107
|
+
|
|
108
|
+
- [#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
|
|
109
|
+
|
|
110
|
+
- [#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.
|
|
111
|
+
|
|
112
|
+
- [#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.
|
|
113
|
+
|
|
3
114
|
## 3.11.0-rc.1
|
|
4
115
|
|
|
5
116
|
### 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 |
|
|
@@ -39,12 +46,12 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
39
46
|
|
|
40
47
|
## Who is Apollo?
|
|
41
48
|
|
|
42
|
-
[Apollo](https://apollographql.com/) builds open-source
|
|
49
|
+
[Apollo](https://apollographql.com/) builds open-source tools and commercial services to make application development easier, better, and accessible to more people. We help you ship faster with:
|
|
43
50
|
|
|
44
|
-
- [
|
|
45
|
-
- [Apollo Federation](https://www.apollographql.com/
|
|
46
|
-
- [Apollo Client](https://
|
|
47
|
-
- [Apollo Server](https://
|
|
51
|
+
- [GraphOS](https://www.apollographql.com/graphos) - The platform for building, managing, and scaling a supergraph: a unified network of your organization's microservices and their data sources—all composed into a single distributed API.
|
|
52
|
+
- [Apollo Federation](https://www.apollographql.com/federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services.
|
|
53
|
+
- [Apollo Client](https://github.com/apollographql/apollo-client) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin).
|
|
54
|
+
- [Apollo Server](https://github.com/apollographql/apollo-server) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.
|
|
48
55
|
|
|
49
56
|
## Learn how to build with Apollo
|
|
50
57
|
|