1 | # @apollo/client
|
2 |
|
3 | ## 3.11.4
|
4 |
|
5 | ### Patch Changes
|
6 |
|
7 | - [#11994](https://github.com/apollographql/apollo-client/pull/11994) [`41b17e5`](https://github.com/apollographql/apollo-client/commit/41b17e5950f4db5ef9e32ded5bb327b3bf19e6e8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Update the `Modifier` function type to allow `cache.modify` to return deeply partial data.
|
8 |
|
9 | - [#11989](https://github.com/apollographql/apollo-client/pull/11989) [`e609156`](https://github.com/apollographql/apollo-client/commit/e609156c4989def88ae1a28b2e0f0378077a5528) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential crash when calling `clearStore` while a query was running.
|
10 |
|
11 | Previously, calling `client.clearStore()` while a query was running had one of these results:
|
12 |
|
13 | - `useQuery` would stay in a `loading: true` state.
|
14 | - `useLazyQuery` would stay in a `loading: true` state, but also crash with a `"Cannot read property 'data' of undefined"` error.
|
15 |
|
16 | Now, in both cases, the hook will enter an error state with a `networkError`, and the promise returned by the `useLazyQuery` `execute` function will return a result in an error state.
|
17 |
|
18 | - [#11994](https://github.com/apollographql/apollo-client/pull/11994) [`41b17e5`](https://github.com/apollographql/apollo-client/commit/41b17e5950f4db5ef9e32ded5bb327b3bf19e6e8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent accidental distribution on `cache.modify` field modifiers when a field is a union type array.
|
19 |
|
20 | ## 3.11.3
|
21 |
|
22 | ### Patch Changes
|
23 |
|
24 | - [#11984](https://github.com/apollographql/apollo-client/pull/11984) [`5db1659`](https://github.com/apollographql/apollo-client/commit/5db1659dc07e3de697894fc1c6f00a151d068291) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where multiple fetches with results that returned errors would sometimes set the `data` property with an `errorPolicy` of `none`.
|
25 |
|
26 | - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where `fetchMore` would write its result data to the cache when using it with a `no-cache` fetch policy.
|
27 |
|
28 | - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where executing `fetchMore` with a `no-cache` fetch policy could sometimes result in multiple network requests.
|
29 |
|
30 | - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! -
|
31 |
|
32 | #### Potentially disruptive change
|
33 |
|
34 | When calling `fetchMore` with a query that has a `no-cache` fetch policy, `fetchMore` will now throw if an `updateQuery` function is not provided. This provides a mechanism to merge the results from the `fetchMore` call with the query's previous result.
|
35 |
|
36 | ## 3.11.2
|
37 |
|
38 | ### Patch Changes
|
39 |
|
40 | - [#11980](https://github.com/apollographql/apollo-client/pull/11980) [`38c0a2c`](https://github.com/apollographql/apollo-client/commit/38c0a2c43dd28677ee240754cd389c8a08c05738) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix missing `getServerSnapshot` error when using `useSubscription` on the server.
|
41 |
|
42 | ## 3.11.1
|
43 |
|
44 | ### Patch Changes
|
45 |
|
46 | - [#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.
|
47 |
|
48 | - [#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.
|
49 |
|
50 | ## 3.11.0
|
51 |
|
52 | ### Potentially Breaking Fixes
|
53 |
|
54 | - [#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`.
|
55 |
|
56 | This was a type bug - these errors were never `GraphQLError` instances
|
57 | to begin with, and the `GraphQLError` class has additional properties that can
|
58 | never be correctly rehydrated from a GraphQL result.
|
59 | The correct type to use here is `GraphQLFormattedError`.
|
60 |
|
61 | Similarly, please ensure to use the type `FormattedExecutionResult`
|
62 | instead of `ExecutionResult` - the non-"Formatted" versions of these types
|
63 | are for use on the server only, but don't get transported over the network.
|
64 |
|
65 | - [#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.
|
66 |
|
67 | 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.
|
68 |
|
69 | 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.
|
70 |
|
71 | As an example, if your code looked like the following:
|
72 |
|
73 | ```js
|
74 | useQuery(QUERY, {
|
75 | nextFetchPolicy(currentFetchPolicy, info) {
|
76 | // your logic here
|
77 | }
|
78 | );
|
79 | ```
|
80 |
|
81 | Update your function to the following to reimplement the resetting behavior:
|
82 |
|
83 | ```js
|
84 | useQuery(QUERY, {
|
85 | nextFetchPolicy(currentFetchPolicy, info) {
|
86 | if (info.reason === 'variables-changed') {
|
87 | return info.initialFetchPolicy;
|
88 | }
|
89 | // your logic here
|
90 | }
|
91 | );
|
92 | ```
|
93 |
|
94 | ### Minor Changes
|
95 |
|
96 | - [#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`.
|
97 |
|
98 | - [#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
|
99 |
|
100 | - [#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`.
|
101 |
|
102 | - [#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.
|
103 |
|
104 | - [#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
|
105 |
|
106 | - [#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.
|
107 |
|
108 | ```ts
|
109 | new ApolloClient({
|
110 | devtools: {
|
111 | enabled: true,
|
112 | name: "Test Client",
|
113 | },
|
114 | });
|
115 | ```
|
116 |
|
117 | This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
|
118 |
|
119 | - [#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`.
|
120 |
|
121 | - [#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).
|
122 |
|
123 | ### Patch Changes
|
124 |
|
125 | - [#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`
|
126 |
|
127 | - [#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`.
|
128 |
|
129 | - [#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`
|
130 |
|
131 | - [#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
|
132 |
|
133 | - [#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`.
|
134 |
|
135 | - [#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
|
136 |
|
137 | - [#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`
|
138 |
|
139 | - [#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.
|
140 |
|
141 | - [#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.
|
142 |
|
143 | - [#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.
|
144 |
|
145 | - [#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`
|
146 |
|
147 | - [#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`
|
148 |
|
149 | ## 3.11.0-rc.2
|
150 |
|
151 | ### Patch Changes
|
152 |
|
153 | - [#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`
|
154 |
|
155 | - [#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
|
156 |
|
157 | - [#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.
|
158 |
|
159 | - [#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.
|
160 |
|
161 | ## 3.11.0-rc.1
|
162 |
|
163 | ### Patch Changes
|
164 |
|
165 | - [#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`
|
166 |
|
167 | - [#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`
|
168 |
|
169 | - [#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.
|
170 |
|
171 | ## 3.11.0-rc.0
|
172 |
|
173 | ### Minor Changes
|
174 |
|
175 | - [#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`.
|
176 |
|
177 | - [#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
|
178 |
|
179 | - [#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`.
|
180 |
|
181 | - [#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.
|
182 |
|
183 | - [#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
|
184 |
|
185 | - [#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.
|
186 |
|
187 | ```ts
|
188 | new ApolloClient({
|
189 | devtools: {
|
190 | enabled: true,
|
191 | name: "Test Client",
|
192 | },
|
193 | });
|
194 | ```
|
195 |
|
196 | This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
|
197 |
|
198 | - [#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`.
|
199 |
|
200 | - [#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`.
|
201 |
|
202 | This was a type bug - these errors were never `GraphQLError` instances
|
203 | to begin with, and the `GraphQLError` class has additional properties that can
|
204 | never be correctly rehydrated from a GraphQL result.
|
205 | The correct type to use here is `GraphQLFormattedError`.
|
206 |
|
207 | Similarly, please ensure to use the type `FormattedExecutionResult`
|
208 | instead of `ExecutionResult` - the non-"Formatted" versions of these types
|
209 | are for use on the server only, but don't get transported over the network.
|
210 |
|
211 | - [#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).
|
212 |
|
213 | ### Patch Changes
|
214 |
|
215 | - [#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`.
|
216 |
|
217 | - [#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`.
|
218 |
|
219 | - [#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
|
220 |
|
221 | - [#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)
|
222 |
|
223 | - [#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`
|
224 |
|
225 | - [#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`
|
226 |
|
227 | ## 3.10.8
|
228 |
|
229 | ### Patch Changes
|
230 |
|
231 | - [#11911](https://github.com/apollographql/apollo-client/pull/11911) [`1f0460a`](https://github.com/apollographql/apollo-client/commit/1f0460a60fc613e8d6f218a74ded69e81e960791) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow `undefined` to be returned from a `cache.modify` modifier function when a generic type argument is used.
|
232 |
|
233 | ## 3.10.7
|
234 |
|
235 | ### Patch Changes
|
236 |
|
237 | - [#11901](https://github.com/apollographql/apollo-client/pull/11901) [`10a8c0a`](https://github.com/apollographql/apollo-client/commit/10a8c0a8f6f3e13ec3c67bf53cc11a948b60e6d9) Thanks [@phryneas](https://github.com/phryneas)! - update `canUseLayoutEffect` check to also allow for layout effects in React Native
|
238 |
|
239 | - [#11861](https://github.com/apollographql/apollo-client/pull/11861) [`1aed0e8`](https://github.com/apollographql/apollo-client/commit/1aed0e82fcc432380a56d4a446f414ce8b1a7a90) Thanks [@henryqdineen](https://github.com/henryqdineen)! - Defend against non-serializable params in `invariantWrappers`
|
240 |
|
241 | - [#11905](https://github.com/apollographql/apollo-client/pull/11905) [`29755da`](https://github.com/apollographql/apollo-client/commit/29755da8797dc94613a23fe050ddd6ef9ffab607) Thanks [@phryneas](https://github.com/phryneas)! - Add `.d.cts` files for cjs bundles
|
242 |
|
243 | - [#11906](https://github.com/apollographql/apollo-client/pull/11906) [`d104759`](https://github.com/apollographql/apollo-client/commit/d104759cfb4be31e2ffbe166531a9b11861ade99) Thanks [@phryneas](https://github.com/phryneas)! - chore: update TypeScript to 5.5
|
244 |
|
245 | ## 3.10.6
|
246 |
|
247 | ### Patch Changes
|
248 |
|
249 | - [#11900](https://github.com/apollographql/apollo-client/pull/11900) [`f745558`](https://github.com/apollographql/apollo-client/commit/f74555826995009a6bb9d824506cecb3508e3365) Thanks [@phryneas](https://github.com/phryneas)! - `useMutation`: use `useIsomorphicLayoutEffect` instead of `useLayoutEffect`
|
250 |
|
251 | ## 3.10.5
|
252 |
|
253 | ### Patch Changes
|
254 |
|
255 | - [#11888](https://github.com/apollographql/apollo-client/pull/11888) [`7fb7939`](https://github.com/apollographql/apollo-client/commit/7fb7939edb7ca8f4273b75554f96ea9936731458) Thanks [@phryneas](https://github.com/phryneas)! - switch `useRenderGuard` to an approach not accessing React's internals
|
256 |
|
257 | - [#11511](https://github.com/apollographql/apollo-client/pull/11511) [`6536369`](https://github.com/apollographql/apollo-client/commit/6536369cf213469d20d15b779c344268d70fecd5) Thanks [@phryneas](https://github.com/phryneas)! - `useLoadableQuery`: ensure that `loadQuery` is updated if the ApolloClient instance changes
|
258 |
|
259 | - [#11860](https://github.com/apollographql/apollo-client/pull/11860) [`8740f19`](https://github.com/apollographql/apollo-client/commit/8740f198805a99e01136617c4055d611b92cc231) Thanks [@alessbell](https://github.com/alessbell)! - Fixes [#11849](https://github.com/apollographql/apollo-client/issues/11849) by reevaluating `window.fetch` each time `BatchHttpLink` uses it, if not configured via `options.fetch`. Takes the same approach as PR [#8603](https://github.com/apollographql/apollo-client/pull/8603) which fixed the same issue in `HttpLink`.
|
260 |
|
261 | - [#11852](https://github.com/apollographql/apollo-client/pull/11852) [`d502a69`](https://github.com/apollographql/apollo-client/commit/d502a69654d8ffa31e09467da028304a934a9874) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where calling the `useMutation` `reset` function would point the hook to an outdated `client` reference.
|
262 |
|
263 | - [#11329](https://github.com/apollographql/apollo-client/pull/11329) [`3d164ea`](https://github.com/apollographql/apollo-client/commit/3d164ea16c17d271f6fa9e5ad8f013623eec23a0) Thanks [@PaLy](https://github.com/PaLy)! - Fix graphQLErrors in Error Link if networkError.result is an empty string
|
264 |
|
265 | - [#11852](https://github.com/apollographql/apollo-client/pull/11852) [`d502a69`](https://github.com/apollographql/apollo-client/commit/d502a69654d8ffa31e09467da028304a934a9874) Thanks [@phryneas](https://github.com/phryneas)! - Prevent writing to a ref in render in `useMutation`.
|
266 | As a result, you might encounter problems in the future if you call the mutation's `execute` function during render. Please note that this was never supported behavior, and we strongly recommend against it.
|
267 |
|
268 | - [#11848](https://github.com/apollographql/apollo-client/pull/11848) [`ad63924`](https://github.com/apollographql/apollo-client/commit/ad6392424ddbeb6f91b165c806251490e1cdd69e) Thanks [@phryneas](https://github.com/phryneas)! - Ensure covariant behavior: `MockedResponse<X,Y>` should be assignable to `MockedResponse`
|
269 |
|
270 | - [#11851](https://github.com/apollographql/apollo-client/pull/11851) [`45c47be`](https://github.com/apollographql/apollo-client/commit/45c47be26d4e020cfcff359a5af19ccfc39b930e) Thanks [@phryneas](https://github.com/phryneas)! - Avoid usage of useRef in useInternalState to prevent ref access in render.
|
271 |
|
272 | - [#11877](https://github.com/apollographql/apollo-client/pull/11877) [`634d91a`](https://github.com/apollographql/apollo-client/commit/634d91aeb10ab308b05d5ffb918678806046af09) Thanks [@phryneas](https://github.com/phryneas)! - Add missing name to tuple member (fix TS5084)
|
273 |
|
274 | - [#11851](https://github.com/apollographql/apollo-client/pull/11851) [`45c47be`](https://github.com/apollographql/apollo-client/commit/45c47be26d4e020cfcff359a5af19ccfc39b930e) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where `useLazyQuery` would not pick up a client change.
|
275 |
|
276 | ## 3.10.4
|
277 |
|
278 | ### Patch Changes
|
279 |
|
280 | - [#11838](https://github.com/apollographql/apollo-client/pull/11838) [`8475346`](https://github.com/apollographql/apollo-client/commit/84753462af50d89c8693713990cccf432ff8267d) Thanks [@alex-kinokon](https://github.com/alex-kinokon)! - Don’t prompt for DevTools installation for browser extension page
|
281 |
|
282 | - [#11839](https://github.com/apollographql/apollo-client/pull/11839) [`6481fe1`](https://github.com/apollographql/apollo-client/commit/6481fe1196cedee987781dcb45ebdc0cafb3998c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix a regression in [3.9.5](https://github.com/apollographql/apollo-client/releases/tag/v3.9.5) where a merge function that returned an incomplete result would not allow the client to refetch in order to fulfill the query.
|
283 |
|
284 | - [#11844](https://github.com/apollographql/apollo-client/pull/11844) [`86984f2`](https://github.com/apollographql/apollo-client/commit/86984f24bd9076a6034acd59bbcb28a2ea1add93) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Honor the `@nonreactive` directive when using `cache.watchFragment` or the `useFragment` hook to avoid rerendering when using these directives.
|
285 |
|
286 | - [#11824](https://github.com/apollographql/apollo-client/pull/11824) [`47ad806`](https://github.com/apollographql/apollo-client/commit/47ad806c7b0c55f1e05dbf276ca87a354ac389e5) Thanks [@phryneas](https://github.com/phryneas)! - Create branded `QueryRef` type without exposed properties.
|
287 |
|
288 | This change deprecates `QueryReference` in favor of a `QueryRef` type that doesn't expose any properties.
|
289 | This change also updates `preloadQuery` to return a new `PreloadedQueryRef` type, which exposes the `toPromise` function as it does today. This means that query refs produced by `useBackgroundQuery` and `useLoadableQuery` now return `QueryRef` types that do not have access to a `toPromise` function, which was never meant to be used in combination with these hooks.
|
290 |
|
291 | While we tend to avoid any types of breaking changes in patch releases as this, this change was necessary to support an upcoming version of the React Server Component integration, which needed to omit the `toPromise` function that would otherwise have broken at runtime.
|
292 | Note that this is a TypeScript-only change. At runtime, `toPromise` is still present on all queryRefs currently created by this package - but we strongly want to discourage you from accessing it in all cases except for the `PreloadedQueryRef` use case.
|
293 |
|
294 | Migration is as simple as replacing all references to `QueryReference` with `QueryRef`, so it should be possible to do this with a search & replace in most code bases:
|
295 |
|
296 | ```diff
|
297 | -import { QueryReference } from '@apollo/client'
|
298 | +import { QueryRef } from '@apollo/client'
|
299 |
|
300 | - function Component({ queryRef }: { queryRef: QueryReference<TData> }) {
|
301 | + function Component({ queryRef }: { queryRef: QueryRef<TData> }) {
|
302 | // ...
|
303 | }
|
304 | ```
|
305 |
|
306 | - [#11845](https://github.com/apollographql/apollo-client/pull/11845) [`4c5c820`](https://github.com/apollographql/apollo-client/commit/4c5c820b6172f6a2455bcdd974109513e0e2a39e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `@nonreactive` directives from queries passed to `MockLink` to ensure they are properly matched.
|
307 |
|
308 | - [#11837](https://github.com/apollographql/apollo-client/pull/11837) [`dff15b1`](https://github.com/apollographql/apollo-client/commit/dff15b1b03ebac9cae508c69bf607a29d0f6eccb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a polled query created in React strict mode may not stop polling after the component unmounts while using the `cache-and-network` fetch policy.
|
309 |
|
310 | ## 3.10.3
|
311 |
|
312 | ### Patch Changes
|
313 |
|
314 | - [#11811](https://github.com/apollographql/apollo-client/pull/11811) [`d67d7f9`](https://github.com/apollographql/apollo-client/commit/d67d7f9a2943273cacaefb26a54184e81f12b022) Thanks [@phryneas](https://github.com/phryneas)! - Adjust some types for React 19 compat
|
315 |
|
316 | - [#11834](https://github.com/apollographql/apollo-client/pull/11834) [`7d8aad4`](https://github.com/apollographql/apollo-client/commit/7d8aad4a00b89e0208ee1563293c24025e6604ce) Thanks [@psamim](https://github.com/psamim)! - Fix error "Cannot convert object to primitive value"
|
317 |
|
318 | ## 3.10.2
|
319 |
|
320 | ### Patch Changes
|
321 |
|
322 | - [#11821](https://github.com/apollographql/apollo-client/pull/11821) [`2675d3c`](https://github.com/apollographql/apollo-client/commit/2675d3c97e6c47c6e298382004c7c9c2d3ffed0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix a regression where rerendering a component with `useBackgroundQuery` would recreate the `queryRef` instance when used with React's strict mode.
|
323 |
|
324 | - [#11821](https://github.com/apollographql/apollo-client/pull/11821) [`2675d3c`](https://github.com/apollographql/apollo-client/commit/2675d3c97e6c47c6e298382004c7c9c2d3ffed0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Revert the change introduced in
|
325 | [3.9.10](https://github.com/apollographql/apollo-client/releases/tag/v3.9.10) via #11738 that disposed of queryRefs synchronously. This change caused too many issues with strict mode.
|
326 |
|
327 | ## 3.10.1
|
328 |
|
329 | ### Patch Changes
|
330 |
|
331 | - [#11792](https://github.com/apollographql/apollo-client/pull/11792) [`5876c35`](https://github.com/apollographql/apollo-client/commit/5876c35530a21473207954d1f0c2b7dd00c0b9ea) Thanks [@phryneas](https://github.com/phryneas)! - AutoCleanedCache: only schedule batched cache cleanup if the cache is full (fixes #11790)
|
332 |
|
333 | - [#11799](https://github.com/apollographql/apollo-client/pull/11799) [`1aca7ed`](https://github.com/apollographql/apollo-client/commit/1aca7ed5a3accf2303ccdf9b3dece7278f03ad62) Thanks [@phryneas](https://github.com/phryneas)! - `RenderPromises`: use `canonicalStringify` to serialize `variables` to ensure query deduplication is properly applied even when `variables` are specified in a different order.
|
334 |
|
335 | - [#11803](https://github.com/apollographql/apollo-client/pull/11803) [`bf9dd17`](https://github.com/apollographql/apollo-client/commit/bf9dd17b288f33901e9421bcc0eacb3894c087af) Thanks [@phryneas](https://github.com/phryneas)! - Update the `rehackt` dependency to `^0.1.0`
|
336 |
|
337 | - [#11756](https://github.com/apollographql/apollo-client/pull/11756) [`60592e9`](https://github.com/apollographql/apollo-client/commit/60592e95399c3695d1d49a4c39ad29f00d4059fd) Thanks [@henryqdineen](https://github.com/henryqdineen)! - Fix operation.setContext() type
|
338 |
|
339 | ## 3.10.0
|
340 |
|
341 | ### Minor Changes
|
342 |
|
343 | - [#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
|
344 |
|
345 | - [#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.
|
346 |
|
347 | - [#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`.
|
348 |
|
349 | - [#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`.
|
350 |
|
351 | - [#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`
|
352 |
|
353 | - [#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
|
354 |
|
355 | - [#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`.
|
356 |
|
357 | - [#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.
|
358 |
|
359 | - [#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.
|
360 |
|
361 | - [#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`
|
362 |
|
363 | ### Patch Changes
|
364 |
|
365 | - [#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.
|
366 |
|
367 | - [#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`.
|
368 |
|
369 | - [#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`.
|
370 |
|
371 | ## 3.10.0-rc.1
|
372 |
|
373 | ### Minor Changes
|
374 |
|
375 | - [#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.
|
376 |
|
377 | - [#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`.
|
378 |
|
379 | - [#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`.
|
380 |
|
381 | - [#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`
|
382 |
|
383 | - [#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`
|
384 |
|
385 | ### Patch Changes
|
386 |
|
387 | - [#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.
|
388 |
|
389 | - [#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`.
|
390 |
|
391 | - [#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`.
|
392 |
|
393 | ## 3.10.0-rc.0
|
394 |
|
395 | ### Minor Changes
|
396 |
|
397 | - [#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
|
398 |
|
399 | - [#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
|
400 |
|
401 | - [#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.
|
402 |
|
403 | - [#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.
|
404 |
|
405 | ## 3.10.0-alpha.0
|
406 |
|
407 | ### Minor Changes
|
408 |
|
409 | - [#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`.
|
410 |
|
411 | ## 3.9.11
|
412 |
|
413 | ### Patch Changes
|
414 |
|
415 | - [#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.
|
416 |
|
417 | ## 3.9.10
|
418 |
|
419 | ### Patch Changes
|
420 |
|
421 | - [#11738](https://github.com/apollographql/apollo-client/pull/11738) [`b1a5eb8`](https://github.com/apollographql/apollo-client/commit/b1a5eb80cae8bdf2e9d8627f1eab65e088c43438) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where rerendering `useBackgroundQuery` after the `queryRef` had been disposed, either via the auto dispose timeout or by unmounting `useReadQuery`, would cause the `queryRef` to be recreated potentially resulting in another network request.
|
422 |
|
423 | - [#11738](https://github.com/apollographql/apollo-client/pull/11738) [`b1a5eb8`](https://github.com/apollographql/apollo-client/commit/b1a5eb80cae8bdf2e9d8627f1eab65e088c43438) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow queryRefs to be disposed of synchronously when a suspense hook unmounts. This prevents some situations where using a suspense hook with the same query/variables as the disposed queryRef accidentally used the disposed queryRef rather than creating a new instance.
|
424 |
|
425 | - [#11670](https://github.com/apollographql/apollo-client/pull/11670) [`cc5c03b`](https://github.com/apollographql/apollo-client/commit/cc5c03b2690f452483d83eecb68611a23055d99e) Thanks [@phryneas](https://github.com/phryneas)! - Bail out of `executeSubSelectedArray` calls if the array has 0 elements.
|
426 |
|
427 | ## 3.9.9
|
428 |
|
429 | ### Patch Changes
|
430 |
|
431 | - [#11696](https://github.com/apollographql/apollo-client/pull/11696) [`466ef82`](https://github.com/apollographql/apollo-client/commit/466ef82198486fc696da64d17d82b46140760ac4) Thanks [@PiR1](https://github.com/PiR1)! - Immediately dispose of the `queryRef` if `useBackgroundQuery` unmounts before the auto dispose timeout kicks in.
|
432 |
|
433 | ## 3.9.8
|
434 |
|
435 | ### Patch Changes
|
436 |
|
437 | - [#11706](https://github.com/apollographql/apollo-client/pull/11706) [`8619bc7`](https://github.com/apollographql/apollo-client/commit/8619bc7e569c1c732afa6faf605c83a6ce0cdf0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue in all suspense hooks where returning an empty array after calling `fetchMore` would rerender the component with an empty list.
|
438 |
|
439 | - [#11694](https://github.com/apollographql/apollo-client/pull/11694) [`835d5f3`](https://github.com/apollographql/apollo-client/commit/835d5f30c532c432e2434561580e6f1ec44cc908) Thanks [@phryneas](https://github.com/phryneas)! - Expose `setErrorMessageHandler` from `@apollo/client/dev` entrypoint.
|
440 |
|
441 | - [#11689](https://github.com/apollographql/apollo-client/pull/11689) [`cb8ffe5`](https://github.com/apollographql/apollo-client/commit/cb8ffe50e903397f741b62a44624bfe69b5f7b75) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where passing a new `from` option to `useFragment` would first render with the previous value before rerendering with the correct value.
|
442 |
|
443 | - [#11713](https://github.com/apollographql/apollo-client/pull/11713) [`642092c`](https://github.com/apollographql/apollo-client/commit/642092c713199093aede45f105a1ee3f637614cd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where setting a default `watchQuery` option in the `ApolloClient` constructor could break `startTransition` when used with suspense hooks.
|
444 |
|
445 | ## 3.9.7
|
446 |
|
447 | ### Patch Changes
|
448 |
|
449 | - [#11659](https://github.com/apollographql/apollo-client/pull/11659) [`652a61e`](https://github.com/apollographql/apollo-client/commit/652a61e96db0f0e27d0a22fafae1df388f3fdf36) Thanks [@phryneas](https://github.com/phryneas)! - Make `useRenderGuard` more resilient to changes in React internals.
|
450 |
|
451 | - [#11594](https://github.com/apollographql/apollo-client/pull/11594) [`50b1097`](https://github.com/apollographql/apollo-client/commit/50b10970ca0efa290ae415ef801650327a89ab8e) Thanks [@alessbell](https://github.com/alessbell)! - Adds a fix for multipart subscriptions that terminate with payload: null
|
452 |
|
453 | ## 3.9.6
|
454 |
|
455 | ### Patch Changes
|
456 |
|
457 | - [#11617](https://github.com/apollographql/apollo-client/pull/11617) [`f1d8bc4`](https://github.com/apollographql/apollo-client/commit/f1d8bc40c3d8e39340f721f4f1c3fd0ed77b8a6b) Thanks [@phryneas](https://github.com/phryneas)! - Allow Apollo Client instance to intercept hook functionality
|
458 |
|
459 | - [#11638](https://github.com/apollographql/apollo-client/pull/11638) [`bf93ada`](https://github.com/apollographql/apollo-client/commit/bf93adaa0321b573db0ea8fc3a5c364e1fdfeef3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where calling `fetchMore` from a suspense-enabled hook inside `startTransition` caused an unnecessary rerender.
|
460 |
|
461 | ## 3.9.5
|
462 |
|
463 | ### Patch Changes
|
464 |
|
465 | - [#11595](https://github.com/apollographql/apollo-client/pull/11595) [`8c20955`](https://github.com/apollographql/apollo-client/commit/8c20955874562e5b2ab35557325e047b059bc4fc) Thanks [@phryneas](https://github.com/phryneas)! - Bumps the dependency `rehackt` to 0.0.5
|
466 |
|
467 | - [#11592](https://github.com/apollographql/apollo-client/pull/11592) [`1133469`](https://github.com/apollographql/apollo-client/commit/1133469bd91ff76b9815e815a454a79d8e23a9bc) Thanks [@Stephen2](https://github.com/Stephen2)! - Strengthen `MockedResponse.newData` type
|
468 |
|
469 | - [#11579](https://github.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://github.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where partial data is reported to `useQuery` when using `notifyOnNetworkStatusChange` after it errors while another overlapping query succeeds.
|
470 |
|
471 | - [#11579](https://github.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://github.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a partial cache write for an errored query would result in automatically refetching that query.
|
472 |
|
473 | - [#11562](https://github.com/apollographql/apollo-client/pull/11562) [`65ab695`](https://github.com/apollographql/apollo-client/commit/65ab695470741e8dcaef1ebd7742c3c397526354) Thanks [@mspiess](https://github.com/mspiess)! - Mocks with an infinite delay no longer require result or error
|
474 |
|
475 | ## 3.9.4
|
476 |
|
477 | ### Patch Changes
|
478 |
|
479 | - [#11403](https://github.com/apollographql/apollo-client/pull/11403) [`b0c4f3a`](https://github.com/apollographql/apollo-client/commit/b0c4f3ad8198981a229b46dc430345a76e577e9c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue in `useLazyQuery` that results in a double network call when calling the execute function with no arguments after having called it previously with another set of arguments.
|
480 |
|
481 | - [#11576](https://github.com/apollographql/apollo-client/pull/11576) [`e855d00`](https://github.com/apollographql/apollo-client/commit/e855d00447e4d9ae478d98f6796d842ef6cc76d1) Thanks [@alessbell](https://github.com/alessbell)! - Revert PR [#11202](https://github.com/apollographql/apollo-client/pull/11202) to fix caching bug reported in [#11560](https://github.com/apollographql/apollo-client/issues/11560)
|
482 |
|
483 | ## 3.9.3
|
484 |
|
485 | ### Patch Changes
|
486 |
|
487 | - [#11525](https://github.com/apollographql/apollo-client/pull/11525) [`dce923a`](https://github.com/apollographql/apollo-client/commit/dce923ae57eb6b6d889e2980635cb90e2c6cbca3) Thanks [@vezaynk](https://github.com/vezaynk)! - Allows passing in client via options to useFragment
|
488 |
|
489 | - [#11558](https://github.com/apollographql/apollo-client/pull/11558) [`8cba16f`](https://github.com/apollographql/apollo-client/commit/8cba16f041609443111ecf5fb58faea1b3e79569) Thanks [@alessbell](https://github.com/alessbell)! - Fix [`unbound-method`](https://github.com/apollographql/apollo-client/issues/11554) linter error on ObservableQuery methods exposed on useQuery's QueryResult object.
|
490 |
|
491 | ## 3.9.2
|
492 |
|
493 | ### Patch Changes
|
494 |
|
495 | - [#11552](https://github.com/apollographql/apollo-client/pull/11552) [`6ac2b0c`](https://github.com/apollographql/apollo-client/commit/6ac2b0ce4d999c63478d85b40ad56ccda9624797) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix import in `useLazyRef` causing import issues in the nextjs package.
|
496 |
|
497 | ## 3.9.1
|
498 |
|
499 | ### Patch Changes
|
500 |
|
501 | - [#11516](https://github.com/apollographql/apollo-client/pull/11516) [`8390fea`](https://github.com/apollographql/apollo-client/commit/8390fea13175bada8361ba5f0df2e43197085aba) Thanks [@phryneas](https://github.com/phryneas)! - Fix an incorrect string substitution in a warning message.
|
502 |
|
503 | - [#11515](https://github.com/apollographql/apollo-client/pull/11515) [`c9bf93b`](https://github.com/apollographql/apollo-client/commit/c9bf93bdc2816f7fdba96961e1435f463f440bd1) Thanks [@vladar](https://github.com/vladar)! - Avoid redundant refetchQueries call for mutation with no-cache policy (fixes #10238)
|
504 |
|
505 | - [#11545](https://github.com/apollographql/apollo-client/pull/11545) [`84a6bea`](https://github.com/apollographql/apollo-client/commit/84a6beaeae69acdffea49ba6b8242752cc188172) Thanks [@alessbell](https://github.com/alessbell)! - Remove error thrown by `inFlightLinkObservables` intended to be removed before 3.9 release.
|
506 |
|
507 | ## 3.9.0
|
508 |
|
509 | ### Minor Changes
|
510 |
|
511 | #### Memory optimizations
|
512 |
|
513 | - [#11424](https://github.com/apollographql/apollo-client/pull/11424) [`62f3b6d`](https://github.com/apollographql/apollo-client/commit/62f3b6d0e89611e27d9f29812ee60e5db5963fd6) Thanks [@phryneas](https://github.com/phryneas)! - Simplify RetryLink, fix potential memory leak
|
514 |
|
515 | Historically, `RetryLink` would keep a `values` array of all previous values, in case the operation would get an additional subscriber at a later point in time.
|
516 |
|
517 | In practice, this could lead to a memory leak ([#11393](https://github.com/apollographql/apollo-client/pull/11393)) and did not serve any further purpose, as the resulting observable would only be subscribed to by Apollo Client itself, and only once - it would be wrapped in a `Concast` before being exposed to the user, and that `Concast` would handle subscribers on its own.
|
518 |
|
519 | - [#11435](https://github.com/apollographql/apollo-client/pull/11435) [`5cce53e`](https://github.com/apollographql/apollo-client/commit/5cce53e83b976f85d2d2b06e28cc38f01324fea1) Thanks [@phryneas](https://github.com/phryneas)! - Deprecates `canonizeResults`.
|
520 |
|
521 | Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
522 |
|
523 | - [#11254](https://github.com/apollographql/apollo-client/pull/11254) [`d08970d`](https://github.com/apollographql/apollo-client/commit/d08970d348cf4ad6d80c6baf85b4a4cd4034a3bb) Thanks [@benjamn](https://github.com/benjamn)! - Decouple `canonicalStringify` from `ObjectCanon` for better time and memory performance.
|
524 |
|
525 | - [#11356](https://github.com/apollographql/apollo-client/pull/11356) [`cc4ac7e`](https://github.com/apollographql/apollo-client/commit/cc4ac7e1917f046bcd177882727864eed40b910e) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential memory leak in `FragmentRegistry.transform` and `FragmentRegistry.findFragmentSpreads` that would hold on to passed-in `DocumentNodes` for too long.
|
526 |
|
527 | - [#11370](https://github.com/apollographql/apollo-client/pull/11370) [`25e2cb4`](https://github.com/apollographql/apollo-client/commit/25e2cb431c76ec5aa88202eaacbd98fad42edc7f) Thanks [@phryneas](https://github.com/phryneas)! - `parse` function: improve memory management
|
528 |
|
529 | - use LRU `WeakCache` instead of `Map` to keep a limited number of parsed results
|
530 | - cache is initiated lazily, only when needed
|
531 | - expose `parse.resetCache()` method
|
532 |
|
533 | - [#11389](https://github.com/apollographql/apollo-client/pull/11389) [`139acd1`](https://github.com/apollographql/apollo-client/commit/139acd1153afa1445b69dcb4e139668ab8c5889a) Thanks [@phryneas](https://github.com/phryneas)! - `documentTransform`: use `optimism` and `WeakCache` instead of directly storing data on the `Trie`
|
534 |
|
535 | - [#11358](https://github.com/apollographql/apollo-client/pull/11358) [`7d939f8`](https://github.com/apollographql/apollo-client/commit/7d939f80fbc2c419c58a6c55b6a35ee7474d0379) Thanks [@phryneas](https://github.com/phryneas)! - Fixes a potential memory leak in `Concast` that might have been triggered when `Concast` was used outside of Apollo Client.
|
536 |
|
537 | - [#11344](https://github.com/apollographql/apollo-client/pull/11344) [`bd26676`](https://github.com/apollographql/apollo-client/commit/bd2667619700139af32a45364794d11f845ab6cf) Thanks [@phryneas](https://github.com/phryneas)! - Add a `resetCache` method to `DocumentTransform` and hook `InMemoryCache.addTypenameTransform` up to `InMemoryCache.gc`
|
538 |
|
539 | - [#11367](https://github.com/apollographql/apollo-client/pull/11367) [`30d17bf`](https://github.com/apollographql/apollo-client/commit/30d17bfebe44dbfa7b78c8982cfeb49afd37129c) Thanks [@phryneas](https://github.com/phryneas)! - `print`: use `WeakCache` instead of `WeakMap`
|
540 |
|
541 | - [#11387](https://github.com/apollographql/apollo-client/pull/11387) [`4dce867`](https://github.com/apollographql/apollo-client/commit/4dce8673b1757d8a3a4edd2996d780e86fad14e3) Thanks [@phryneas](https://github.com/phryneas)! - `QueryManager.transformCache`: use `WeakCache` instead of `WeakMap`
|
542 |
|
543 | - [#11369](https://github.com/apollographql/apollo-client/pull/11369) [`2a47164`](https://github.com/apollographql/apollo-client/commit/2a471646616e3af1b5c039e961f8d5717fad8f32) Thanks [@phryneas](https://github.com/phryneas)! - Persisted Query Link: improve memory management
|
544 |
|
545 | - use LRU `WeakCache` instead of `WeakMap` to keep a limited number of hash results
|
546 | - hash cache is initiated lazily, only when needed
|
547 | - expose `persistedLink.resetHashCache()` method
|
548 | - reset hash cache if the upstream server reports it doesn't accept persisted queries
|
549 |
|
550 | - [#10804](https://github.com/apollographql/apollo-client/pull/10804) [`221dd99`](https://github.com/apollographql/apollo-client/commit/221dd99ffd1990f8bd0392543af35e9b08d0fed8) Thanks [@phryneas](https://github.com/phryneas)! - use WeakMap in React Native with Hermes
|
551 |
|
552 | - [#11355](https://github.com/apollographql/apollo-client/pull/11355) [`7d8e184`](https://github.com/apollographql/apollo-client/commit/7d8e18493cd13134726c6643cbf0fadb08be2d37) Thanks [@phryneas](https://github.com/phryneas)! - InMemoryCache.gc now also triggers FragmentRegistry.resetCaches (if there is a FragmentRegistry)
|
553 |
|
554 | - [#11409](https://github.com/apollographql/apollo-client/pull/11409) [`2e7203b`](https://github.com/apollographql/apollo-client/commit/2e7203b3a9618952ddb522627ded7cceabd7f250) Thanks [@phryneas](https://github.com/phryneas)! - Adds an experimental `ApolloClient.getMemoryInternals` helper
|
555 |
|
556 | - [#11343](https://github.com/apollographql/apollo-client/pull/11343) [`776631d`](https://github.com/apollographql/apollo-client/commit/776631de4500d56252f6f5fdaf29a81c41dfbdc7) Thanks [@phryneas](https://github.com/phryneas)! - Add `reset` method to `print`, hook up to `InMemoryCache.gc`
|
557 |
|
558 | #### Suspense-enabled data fetching on user interaction with `useLoadableQuery`
|
559 |
|
560 | - [#11300](https://github.com/apollographql/apollo-client/pull/11300) [`a815873`](https://github.com/apollographql/apollo-client/commit/a8158733cfa3e65180ec23518d657ea41894bb2b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduces a new `useLoadableQuery` hook. This hook works similarly to `useBackgroundQuery` in that it returns a `queryRef` that can be used to suspend a component via the `useReadQuery` hook. It provides a more ergonomic way to load the query during a user interaction (for example when wanting to preload some data) that would otherwise be clunky with `useBackgroundQuery`.
|
561 |
|
562 | ```tsx
|
563 | function App() {
|
564 | const [loadQuery, queryRef, { refetch, fetchMore, reset }] =
|
565 | useLoadableQuery(query, options);
|
566 |
|
567 | return (
|
568 | <>
|
569 | <button onClick={() => loadQuery(variables)}>Load query</button>
|
570 | <Suspense fallback={<SuspenseFallback />}>
|
571 | {queryRef && <Child queryRef={queryRef} />}
|
572 | </Suspense>
|
573 | </>
|
574 | );
|
575 | }
|
576 |
|
577 | function Child({ queryRef }) {
|
578 | const { data } = useReadQuery(queryRef);
|
579 |
|
580 | // ...
|
581 | }
|
582 | ```
|
583 |
|
584 | #### Begin preloading outside of React with `createQueryPreloader`
|
585 |
|
586 | - [#11412](https://github.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://github.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to start preloading a query outside React to begin fetching as early as possible. Call `createQueryPreloader` to create a `preloadQuery` function which can be called to start fetching a query. This returns a `queryRef` which is passed to `useReadQuery` and suspended until the query is done fetching.
|
587 |
|
588 | ```tsx
|
589 | const preloadQuery = createQueryPreloader(client);
|
590 | const queryRef = preloadQuery(QUERY, { variables, ...otherOptions });
|
591 |
|
592 | function App() {
|
593 | return {
|
594 | <Suspense fallback={<div>Loading</div>}>
|
595 | <MyQuery />
|
596 | </Suspense>
|
597 | }
|
598 | }
|
599 |
|
600 | function MyQuery() {
|
601 | const { data } = useReadQuery(queryRef);
|
602 |
|
603 | // do something with data
|
604 | }
|
605 | ```
|
606 |
|
607 | #### Testing utility improvements
|
608 |
|
609 | - [#11178](https://github.com/apollographql/apollo-client/pull/11178) [`4d64a6f`](https://github.com/apollographql/apollo-client/commit/4d64a6fa2ad5abe6f7f172c164f5e1fc2cb89829) Thanks [@sebakerckhof](https://github.com/sebakerckhof)! - Support re-using of mocks in the MockedProvider
|
610 |
|
611 | - [#6701](https://github.com/apollographql/apollo-client/pull/6701) [`8d2b4e1`](https://github.com/apollographql/apollo-client/commit/8d2b4e107d7c21563894ced3a65d631183b58fd9) Thanks [@prowe](https://github.com/prowe)! - Ability to dynamically match mocks
|
612 |
|
613 | Adds support for a new property `MockedResponse.variableMatcher`: a predicate function that accepts a `variables` param. If `true`, the `variables` will be passed into the `ResultFunction` to help dynamically build a response.
|
614 |
|
615 | #### New `useQueryRefHandlers` hook
|
616 |
|
617 | - [#11412](https://github.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://github.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Create a new `useQueryRefHandlers` hook that returns `refetch` and `fetchMore` functions for a given `queryRef`. This is useful to get access to handlers for a `queryRef` that was created by `createQueryPreloader` or when the handlers for a `queryRef` produced by a different component are inaccessible.
|
618 |
|
619 | ```jsx
|
620 | const MyComponent({ queryRef }) {
|
621 | const { refetch, fetchMore } = useQueryRefHandlers(queryRef);
|
622 |
|
623 | // ...
|
624 | }
|
625 | ```
|
626 |
|
627 | #### Bail out of `optimisticResponse` updates with the `IGNORE` sentinel object
|
628 |
|
629 | - [#11410](https://github.com/apollographql/apollo-client/pull/11410) [`07fcf6a`](https://github.com/apollographql/apollo-client/commit/07fcf6a3bf5bc78ffe6f3e598897246b4da02cbb) Thanks [@sf-twingate](https://github.com/sf-twingate)! - Allow returning `IGNORE` sentinel object from `optimisticResponse` functions to bail-out from the optimistic update.
|
630 |
|
631 | Consider this example:
|
632 |
|
633 | ```jsx
|
634 | const UPDATE_COMMENT = gql`
|
635 | mutation UpdateComment($commentId: ID!, $commentContent: String!) {
|
636 | updateComment(commentId: $commentId, content: $commentContent) {
|
637 | id
|
638 | __typename
|
639 | content
|
640 | }
|
641 | }
|
642 | `;
|
643 |
|
644 | function CommentPageWithData() {
|
645 | const [mutate] = useMutation(UPDATE_COMMENT);
|
646 | return (
|
647 | <Comment
|
648 | updateComment={({ commentId, commentContent }) =>
|
649 | mutate({
|
650 | variables: { commentId, commentContent },
|
651 | optimisticResponse: (vars, { IGNORE }) => {
|
652 | if (commentContent === "foo") {
|
653 | // conditionally bail out of optimistic updates
|
654 | return IGNORE;
|
655 | }
|
656 | return {
|
657 | updateComment: {
|
658 | id: commentId,
|
659 | __typename: "Comment",
|
660 | content: commentContent,
|
661 | },
|
662 | };
|
663 | },
|
664 | })
|
665 | }
|
666 | />
|
667 | );
|
668 | }
|
669 | ```
|
670 |
|
671 | The `IGNORE` sentinel can be destructured from the second parameter in the callback function signature passed to `optimisticResponse`.
|
672 |
|
673 | #### Network adapters for multipart subscriptions usage with Relay and urql
|
674 |
|
675 | - [#11301](https://github.com/apollographql/apollo-client/pull/11301) [`46ab032`](https://github.com/apollographql/apollo-client/commit/46ab032af83a01f184bfcce5edba4b55dbb2962a) Thanks [@alessbell](https://github.com/alessbell)! - Add multipart subscription network adapters for Relay and urql
|
676 |
|
677 | ##### Relay
|
678 |
|
679 | ```tsx
|
680 | import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/relay";
|
681 | import { Environment, Network, RecordSource, Store } from "relay-runtime";
|
682 |
|
683 | const fetchMultipartSubs = createFetchMultipartSubscription(
|
684 | "http://localhost:4000"
|
685 | );
|
686 |
|
687 | const network = Network.create(fetchQuery, fetchMultipartSubs);
|
688 |
|
689 | export const RelayEnvironment = new Environment({
|
690 | network,
|
691 | store: new Store(new RecordSource()),
|
692 | });
|
693 | ```
|
694 |
|
695 | ##### Urql
|
696 |
|
697 | ```tsx
|
698 | import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/urql";
|
699 | import { Client, fetchExchange, subscriptionExchange } from "@urql/core";
|
700 |
|
701 | const url = "http://localhost:4000";
|
702 |
|
703 | const multipartSubscriptionForwarder = createFetchMultipartSubscription(url);
|
704 |
|
705 | const client = new Client({
|
706 | url,
|
707 | exchanges: [
|
708 | fetchExchange,
|
709 | subscriptionExchange({
|
710 | forwardSubscription: multipartSubscriptionForwarder,
|
711 | }),
|
712 | ],
|
713 | });
|
714 | ```
|
715 |
|
716 | #### `skipPollAttempt` callback function
|
717 |
|
718 | - [#11397](https://github.com/apollographql/apollo-client/pull/11397) [`3f7eecb`](https://github.com/apollographql/apollo-client/commit/3f7eecbfbd4f4444cffcaac7dd9fd225c8c2a401) Thanks [@aditya-kumawat](https://github.com/aditya-kumawat)! - Adds a new `skipPollAttempt` callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval. This will solve the frequent use-case of disabling polling when the window is inactive.
|
719 |
|
720 | ```ts
|
721 | useQuery(QUERY, {
|
722 | pollInterval: 1000,
|
723 | skipPollAttempt: () => document.hidden, // or !document.hasFocus()
|
724 | });
|
725 | // or define it globally
|
726 | new ApolloClient({
|
727 | defaultOptions: {
|
728 | watchQuery: {
|
729 | skipPollAttempt: () => document.hidden, // or !document.hasFocus()
|
730 | },
|
731 | },
|
732 | });
|
733 | ```
|
734 |
|
735 | #### `QueryManager.inFlightLinkObservables` now uses a strong `Trie` as an internal data structure
|
736 |
|
737 | - [#11345](https://github.com/apollographql/apollo-client/pull/11345) [`1759066`](https://github.com/apollographql/apollo-client/commit/1759066a8f9a204e49228568aef9446a64890ff3) Thanks [@phryneas](https://github.com/phryneas)!
|
738 |
|
739 | ##### Warning: requires `@apollo/experimental-nextjs-app-support` update
|
740 |
|
741 | If you are using `@apollo/experimental-nextjs-app-support`, you will need to update that to at least 0.5.2, as it accesses this internal data structure.
|
742 |
|
743 | <details open>
|
744 | <summary><h4>More Minor Changes</h4></summary>
|
745 |
|
746 | - [#11202](https://github.com/apollographql/apollo-client/pull/11202) [`7c2bc08`](https://github.com/apollographql/apollo-client/commit/7c2bc08b2ab46b9aa181d187a27aec2ad7129599) Thanks [@benjamn](https://github.com/benjamn)! - Prevent `QueryInfo#markResult` mutation of `result.data` and return cache data consistently whether complete or incomplete.
|
747 |
|
748 | - [#11442](https://github.com/apollographql/apollo-client/pull/11442) [`4b6f2bc`](https://github.com/apollographql/apollo-client/commit/4b6f2bccf3ba94643b38689b32edd2839e47aec1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the need to call `retain` from `useLoadableQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you.
|
749 |
|
750 | Thanks to [#11412](https://github.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed.
|
751 |
|
752 | - [#11438](https://github.com/apollographql/apollo-client/pull/11438) [`6d46ab9`](https://github.com/apollographql/apollo-client/commit/6d46ab930a5e9bd5cae153d3b75b8966784fcd4e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the need to call `retain` from `useBackgroundQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you.
|
753 |
|
754 | Thanks to [#11412](https://github.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed.
|
755 |
|
756 | - [#11175](https://github.com/apollographql/apollo-client/pull/11175) [`d6d1491`](https://github.com/apollographql/apollo-client/commit/d6d14911c40782cd6d69167b6f6169c890091ccb) Thanks [@phryneas](https://github.com/phryneas)! - To work around issues in React Server Components, especially with bundling for
|
757 | the Next.js "edge" runtime we now use an external package to wrap `react` imports
|
758 | instead of importing React directly.
|
759 |
|
760 | - [#11495](https://github.com/apollographql/apollo-client/pull/11495) [`1190aa5`](https://github.com/apollographql/apollo-client/commit/1190aa59a106217f7192c1f81099adfa5e4365c1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Increase the default memory limits for `executeSelectionSet` and `executeSelectionSetArray`.
|
761 |
|
762 | </details>
|
763 |
|
764 | <details open>
|
765 | <summary><h3>Patch Changes</h3></summary>
|
766 |
|
767 | - [#11275](https://github.com/apollographql/apollo-client/pull/11275) [`3862f9b`](https://github.com/apollographql/apollo-client/commit/3862f9ba9086394c4cf4c2ecd99e8e0f6cf44885) Thanks [@phryneas](https://github.com/phryneas)! - Add a `defaultContext` option and property on `ApolloClient`, e.g. for keeping track of changing auth tokens or dependency injection.
|
768 |
|
769 | This can be used e.g. in authentication scenarios, where a new token might be generated outside of the link chain and should passed into the link chain.
|
770 |
|
771 | ```js
|
772 | import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client";
|
773 | import { setContext } from "@apollo/client/link/context";
|
774 |
|
775 | const httpLink = createHttpLink({
|
776 | uri: "/graphql",
|
777 | });
|
778 |
|
779 | const authLink = setContext((_, { headers, token }) => {
|
780 | return {
|
781 | headers: {
|
782 | ...headers,
|
783 | authorization: token ? `Bearer ${token}` : "",
|
784 | },
|
785 | };
|
786 | });
|
787 |
|
788 | const client = new ApolloClient({
|
789 | link: authLink.concat(httpLink),
|
790 | cache: new InMemoryCache(),
|
791 | });
|
792 |
|
793 | // somewhere else in your application
|
794 | function onNewToken(newToken) {
|
795 | // token can now be changed for future requests without need for a global
|
796 | // variable, scoped ref or recreating the client
|
797 | client.defaultContext.token = newToken;
|
798 | }
|
799 | ```
|
800 |
|
801 | - [#11443](https://github.com/apollographql/apollo-client/pull/11443) [`ff5a332`](https://github.com/apollographql/apollo-client/commit/ff5a332ff8b190c418df25371e36719d70061ebe) Thanks [@phryneas](https://github.com/phryneas)! - Adds a deprecation warning to the HOC and render prop APIs.
|
802 |
|
803 | The HOC and render prop APIs have already been deprecated since 2020,
|
804 | but we previously didn't have a `@deprecated` tag in the DocBlocks.
|
805 |
|
806 | - [#11385](https://github.com/apollographql/apollo-client/pull/11385) [`d9ca4f0`](https://github.com/apollographql/apollo-client/commit/d9ca4f0821c66ae4f03cf35a7ac93fe604cc6de3) Thanks [@phryneas](https://github.com/phryneas)! - ensure `defaultContext` is also used for mutations and subscriptions
|
807 |
|
808 | - [#11503](https://github.com/apollographql/apollo-client/pull/11503) [`67f62e3`](https://github.com/apollographql/apollo-client/commit/67f62e359bc471787d066319326e5582b4a635c8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Release changes from [`v3.8.10`](https://github.com/apollographql/apollo-client/releases/tag/v3.8.10)
|
809 |
|
810 | - [#11078](https://github.com/apollographql/apollo-client/pull/11078) [`14edebe`](https://github.com/apollographql/apollo-client/commit/14edebebefb7634c32b921d02c1c85c6c8737989) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery: prevent reporting results of previous queries if the variables changed since
|
811 |
|
812 | - [#11439](https://github.com/apollographql/apollo-client/pull/11439) [`33454f0`](https://github.com/apollographql/apollo-client/commit/33454f0a40a05ea2b00633bda20a84d0ec3a4f4d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Address bundling issue introduced in [#11412](https://github.com/apollographql/apollo-client/pull/11412) where the `react/cache` internals ended up duplicated in the bundle. This was due to the fact that we had a `react/hooks` entrypoint that imported these files along with the newly introduced `createQueryPreloader` function, which lived outside of the `react/hooks` folder.
|
813 |
|
814 | - [#11371](https://github.com/apollographql/apollo-client/pull/11371) [`ebd8fe2`](https://github.com/apollographql/apollo-client/commit/ebd8fe2c1b8b50bfeb2da20aeca5671300fb5564) Thanks [@phryneas](https://github.com/phryneas)! - Clarify types of `EntityStore.makeCacheKey`.
|
815 |
|
816 | </details>
|
817 |
|
818 | ## 3.8.10
|
819 |
|
820 | ### Patch Changes
|
821 |
|
822 | - [#11489](https://github.com/apollographql/apollo-client/pull/11489) [`abfd02a`](https://github.com/apollographql/apollo-client/commit/abfd02abeb8585e44377e9e87e5d20e5d95be002) Thanks [@gronxb](https://github.com/gronxb)! - Fix `networkStatus` with `useSuspenseQuery` not properly updating to ready state when using a `cache-and-network` fetch policy that returns data equal to what is already in the cache.
|
823 |
|
824 | - [#11483](https://github.com/apollographql/apollo-client/pull/11483) [`6394dda`](https://github.com/apollographql/apollo-client/commit/6394dda47fa83d9ddd922e0d05e62bd872e4ea8e) Thanks [@pipopotamasu](https://github.com/pipopotamasu)! - Fix cache override warning output
|
825 |
|
826 | ## 3.8.9
|
827 |
|
828 | ### Patch Changes
|
829 |
|
830 | - [#11472](https://github.com/apollographql/apollo-client/pull/11472) [`afc844d`](https://github.com/apollographql/apollo-client/commit/afc844dd8d6f9f7a3e2003f9a5b541291dfe3fb4) Thanks [@alessbell](https://github.com/alessbell)! - Fix delay: Infinity when set on a MockResponse passed to Mocked Provider so it indefinitely enters loading state.
|
831 |
|
832 | - [#11464](https://github.com/apollographql/apollo-client/pull/11464) [`aac12b2`](https://github.com/apollographql/apollo-client/commit/aac12b221a6cb776d4941b6c8aadf04f0f0acd27) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent `useFragment` from excessively unsubscribing and resubscribing the fragment with the cache on every render.
|
833 |
|
834 | - [#11449](https://github.com/apollographql/apollo-client/pull/11449) [`f40cda4`](https://github.com/apollographql/apollo-client/commit/f40cda45841e93b056c781c19651b54464f7346a) Thanks [@phryneas](https://github.com/phryneas)! - Removes refences to the typescript "dom" lib.
|
835 |
|
836 | - [#11470](https://github.com/apollographql/apollo-client/pull/11470) [`e293bc9`](https://github.com/apollographql/apollo-client/commit/e293bc90d6f7937a6fc7c169f7b16eeb39d5fd49) Thanks [@phryneas](https://github.com/phryneas)! - Remove an unnecessary check from parseAndCheckHttpResponse.
|
837 |
|
838 | ## 3.8.8
|
839 |
|
840 | ### Patch Changes
|
841 |
|
842 | - [#11200](https://github.com/apollographql/apollo-client/pull/11200) [`ae5091a21`](https://github.com/apollographql/apollo-client/commit/ae5091a21f0feff1486503071ea8dc002cf1be41) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Enable `strict` in tsconfig for the entire project.
|
843 |
|
844 | - [#11332](https://github.com/apollographql/apollo-client/pull/11332) [`291aea56b`](https://github.com/apollographql/apollo-client/commit/291aea56bfaed3987a98be7fe4e6160114b62d2d) Thanks [@asvishnyakov](https://github.com/asvishnyakov)! - Add missed reexports of MutationFetchPolicy and RefetchWritePolicy to @apollo/client/core
|
845 |
|
846 | - [#10931](https://github.com/apollographql/apollo-client/pull/10931) [`e5acf910e`](https://github.com/apollographql/apollo-client/commit/e5acf910e39752b453540b6751046d1c19b66350) Thanks [@phryneas](https://github.com/phryneas)! - `useMutation`: also reset internal state on reset
|
847 |
|
848 | ## 3.8.7
|
849 |
|
850 | ### Patch Changes
|
851 |
|
852 | - [#11297](https://github.com/apollographql/apollo-client/pull/11297) [`c8c76a522`](https://github.com/apollographql/apollo-client/commit/c8c76a522e593de0d06cff73fde2d9e88152bed6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add an explicit return type for the `useReadQuery` hook called `UseReadQueryResult`. Previously the return type of this hook was inferred from the return value.
|
853 |
|
854 | - [#11337](https://github.com/apollographql/apollo-client/pull/11337) [`bb1da8349`](https://github.com/apollographql/apollo-client/commit/bb1da8349e785c54fb4030f269602c900adf23a0) Thanks [@phryneas](https://github.com/phryneas)! - #11206 used the TypeScript syntax `infer X extends Y` that was introduced in TS 4.8.
|
855 | This caused some problems for some users, so we are rolling back to a more backwars-compatible (albeit slightly less performant) type.
|
856 |
|
857 | ## 3.8.6
|
858 |
|
859 | ### Patch Changes
|
860 |
|
861 | - [#11291](https://github.com/apollographql/apollo-client/pull/11291) [`2be7eafe3`](https://github.com/apollographql/apollo-client/commit/2be7eafe3c115d56d993dbda64d320550712df1f) Thanks [@ArioA](https://github.com/ArioA)! - Fix a bug that allows to only call `loadErrorMessages` without also calling `loadDevErrorMessages`.
|
862 |
|
863 | - [#11274](https://github.com/apollographql/apollo-client/pull/11274) [`b29f000f3`](https://github.com/apollographql/apollo-client/commit/b29f000f36f281e256809b5454eaeca2ec4450bf) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Start the query ref auto dispose timeout after the initial promise has settled. This prevents requests that run longer than the timeout duration from keeping the component suspended indefinitely.
|
864 |
|
865 | - [#11289](https://github.com/apollographql/apollo-client/pull/11289) [`b5894dbf0`](https://github.com/apollographql/apollo-client/commit/b5894dbf0fd5ea5ef1ff20dd896a658ef78c69dc) Thanks [@phryneas](https://github.com/phryneas)! - `MockedProvider`: default `connectToDevTools` to `false` in created `ApolloClient` instance.
|
866 |
|
867 | This will prevent the mocked `ApolloClient` instance from trying to connect to the DevTools, which would start a `setTimeout` that might keep running after a test has finished.
|
868 |
|
869 | - [#11206](https://github.com/apollographql/apollo-client/pull/11206) [`dd2ce7687`](https://github.com/apollographql/apollo-client/commit/dd2ce7687ae9afa399e950a523fc7330284c25fe) Thanks [@phryneas](https://github.com/phryneas)! - `cache.modify`: Less strict types & new dev runtime warnings.
|
870 |
|
871 | ## 3.8.5
|
872 |
|
873 | ### Patch Changes
|
874 |
|
875 | - [#11266](https://github.com/apollographql/apollo-client/pull/11266) [`5192cf6e1`](https://github.com/apollographql/apollo-client/commit/5192cf6e1e958080bcae09e5967fa6851bd3a78c) Thanks [@phryneas](https://github.com/phryneas)! - Fixes argument handling for invariant log messages.
|
876 |
|
877 | - [#11235](https://github.com/apollographql/apollo-client/pull/11235) [`6cddaaf65`](https://github.com/apollographql/apollo-client/commit/6cddaaf6543f5c0b1fb04ba47480fb393ba10de7) Thanks [@phryneas](https://github.com/phryneas)! - Fix nextFetchPolicy behaviour with transformed documents by keeping `options` reference stable when passing it through QueryManager.
|
878 |
|
879 | - [#11252](https://github.com/apollographql/apollo-client/pull/11252) [`327a2abbd`](https://github.com/apollographql/apollo-client/commit/327a2abbd5db87ca27f2ffd1d2f8dccd75868a58) Thanks [@phryneas](https://github.com/phryneas)! - Fixes a race condition in asyncMap that caused issues in React Native when errors were returned in the response payload along with a data property that was null.
|
880 |
|
881 | - [#11229](https://github.com/apollographql/apollo-client/pull/11229) [`c372bad4e`](https://github.com/apollographql/apollo-client/commit/c372bad4ebd01a4f2e772cd76e873143bf043fe6) Thanks [@phryneas](https://github.com/phryneas)! - Remove (already throwing) SuspenseCache export that should have been removed in 3.8.
|
882 |
|
883 | - [#11267](https://github.com/apollographql/apollo-client/pull/11267) [`bc055e068`](https://github.com/apollographql/apollo-client/commit/bc055e0683e87b9445e321f73857f4a91b20a9ce) Thanks [@phryneas](https://github.com/phryneas)! - Remove some dead code.
|
884 |
|
885 | ## 3.8.4
|
886 |
|
887 | ### Patch Changes
|
888 |
|
889 | - [#11195](https://github.com/apollographql/apollo-client/pull/11195) [`9e59b251d`](https://github.com/apollographql/apollo-client/commit/9e59b251d4d63afb83d9821889f87c71c4adde0f) Thanks [@phryneas](https://github.com/phryneas)! - For `invariant.log` etc., error arguments are now serialized correctly in the link to the error page.
|
890 |
|
891 | ## 3.8.3
|
892 |
|
893 | ### Patch Changes
|
894 |
|
895 | - [#11193](https://github.com/apollographql/apollo-client/pull/11193) [`fd2a4cf0c`](https://github.com/apollographql/apollo-client/commit/fd2a4cf0c3ada968df3f9814d87dedaaa8eddb5e) Thanks [@phryneas](https://github.com/phryneas)! - Call devtools registration after ApolloClient is fully set up.
|
896 |
|
897 | ## 3.8.2
|
898 |
|
899 | ### Patch Changes
|
900 |
|
901 | - [#10072](https://github.com/apollographql/apollo-client/pull/10072) [`51045c336`](https://github.com/apollographql/apollo-client/commit/51045c336ff86befbdd598af6e7104ffe0d419d0) Thanks [@Huulivoide](https://github.com/Huulivoide)! - Fixes race conditions in useReactiveVar that may prevent updates to the reactive variable from propagating through the hook.
|
902 |
|
903 | - [#11162](https://github.com/apollographql/apollo-client/pull/11162) [`d9685f53c`](https://github.com/apollographql/apollo-client/commit/d9685f53c34483245e6ea21e91b669ef1180ae97) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensures GraphQL errors returned in subscription payloads adhere to the `errorPolicy` set in `client.subscribe(...)` calls.
|
904 |
|
905 | - [#11134](https://github.com/apollographql/apollo-client/pull/11134) [`96492e142`](https://github.com/apollographql/apollo-client/commit/96492e14279d78e2613c1381d31f88cdf5816f45) Thanks [@alessbell](https://github.com/alessbell)! - Use separate type imports in useSuspenseQuery and useBackgroundQuery to workaround SWC compiler issue.
|
906 |
|
907 | - [#11117](https://github.com/apollographql/apollo-client/pull/11117) [`6b8198109`](https://github.com/apollographql/apollo-client/commit/6b8198109bd9fe5eedf352421a0a773ac0acfb18) Thanks [@phryneas](https://github.com/phryneas)! - Adds a new devtools registration mechanism and tweaks the mechanism behind the
|
908 | "devtools not found" mechanic.
|
909 |
|
910 | - [#11186](https://github.com/apollographql/apollo-client/pull/11186) [`f1d429f32`](https://github.com/apollographql/apollo-client/commit/f1d429f32ae8e896155b50f1fc7c51dfeb06c3ba) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where race conditions when rapidly switching between variables would sometimes result in the wrong `data` returned from the query. Specifically this occurs when a query is triggered with an initial set of variables (`VariablesA`), then triggers the same query with another set of variables (`VariablesB`) but switches back to the `VariablesA` before the response for `VariablesB` is returned. Previously this would result in the data for `VariablesB` to be displayed while `VariablesA` was active. The data is for `VariablesA` is now properly returned.
|
911 |
|
912 | - [#11163](https://github.com/apollographql/apollo-client/pull/11163) [`a8a9e11e9`](https://github.com/apollographql/apollo-client/commit/a8a9e11e917716538206eb7d5de21dbfd09630bd) Thanks [@bignimbus](https://github.com/bignimbus)! - Fix typo in error message: "occured" -> "occurred"
|
913 |
|
914 | - [#11180](https://github.com/apollographql/apollo-client/pull/11180) [`7d9c481e5`](https://github.com/apollographql/apollo-client/commit/7d9c481e53f3c9577ec6ed6231c9e3db8c8b374b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where refetching from `useBackgroundQuery` via `refetch` with an error after an error was already fetched would get stuck in a loading state.
|
915 |
|
916 | ## 3.8.1
|
917 |
|
918 | ### Patch Changes
|
919 |
|
920 | - [#11141](https://github.com/apollographql/apollo-client/pull/11141) [`c469b1616`](https://github.com/apollographql/apollo-client/commit/c469b1616517aac124a3357066cd83439463033c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove newly exported response iterator helpers that caused problems on some installs where `@types/node` was not available.
|
921 |
|
922 | **IMPORTANT**
|
923 |
|
924 | The following exports were added in version 3.8.0 that are removed with this patch.
|
925 |
|
926 | - `isAsyncIterableIterator`
|
927 | - `isBlob`
|
928 | - `isNodeReadableStream`
|
929 | - `isNodeResponse`
|
930 | - `isReadableStream`
|
931 | - `isStreamableBlob`
|
932 |
|
933 | ## 3.8.0
|
934 |
|
935 | ### Minor Changes
|
936 |
|
937 | #### Fetching with Suspense 🎉
|
938 |
|
939 | - [#10323](https://github.com/apollographql/apollo-client/pull/10323) [`64cb88a4b`](https://github.com/apollographql/apollo-client/commit/64cb88a4b6be8640c4e0d753dd06ddf4c25a2bc3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for React suspense with a new `useSuspenseQuery` hook.
|
940 |
|
941 | `useSuspenseQuery` initiates a network request and causes the component calling it to suspend while the request is in flight. It can be thought of as a drop-in replacement for `useQuery` that allows you to take advantage of React's concurrent features while fetching during render.
|
942 |
|
943 | Consider a `Dog` component that fetches and renders some information about a dog named Mozzarella:
|
944 |
|
945 | <details>
|
946 | <summary>View code 🐶</summary>
|
947 |
|
948 | ```tsx
|
949 | import { Suspense } from "react";
|
950 | import { gql, TypedDocumentNode, useSuspenseQuery } from "@apollo/client";
|
951 |
|
952 | interface Data {
|
953 | dog: {
|
954 | id: string;
|
955 | name: string;
|
956 | };
|
957 | }
|
958 |
|
959 | interface Variables {
|
960 | name: string;
|
961 | }
|
962 |
|
963 | const GET_DOG_QUERY: TypedDocumentNode<Data, Variables> = gql`
|
964 | query GetDog($name: String) {
|
965 | dog(name: $name) {
|
966 | id
|
967 | name
|
968 | }
|
969 | }
|
970 | `;
|
971 |
|
972 | function App() {
|
973 | return (
|
974 | <Suspense fallback={<div>Loading...</div>}>
|
975 | <Dog name="Mozzarella" />
|
976 | </Suspense>
|
977 | );
|
978 | }
|
979 |
|
980 | function Dog({ name }: { name: string }) {
|
981 | const { data } = useSuspenseQuery(GET_DOG_QUERY, {
|
982 | variables: { name },
|
983 | });
|
984 |
|
985 | return <>Name: {data.dog.name}</>;
|
986 | }
|
987 | ```
|
988 |
|
989 | </details>
|
990 |
|
991 | For a detailed explanation of `useSuspenseQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
|
992 |
|
993 | - [#10755](https://github.com/apollographql/apollo-client/pull/10755) [`e3c676deb`](https://github.com/apollographql/apollo-client/commit/e3c676deb59d006f33d24a7211e58725a67641b8) Thanks [@alessbell](https://github.com/alessbell)! - Feature: adds `useBackgroundQuery` and `useReadQuery` hooks
|
994 |
|
995 | `useBackgroundQuery` initiates a request for data in a parent component and returns a `QueryReference` which is used to read the data in a child component via `useReadQuery`. If the child component attempts to render before the data can be found in the cache, the child component will suspend until the data is available. On cache updates to watched data, the child component calling `useReadQuery` will re-render with new data **but the parent component will not re-render** (as it would, for example, if it were using `useQuery` to issue the request).
|
996 |
|
997 | Consider an `App` component that fetches a list of breeds in the background while also fetching and rendering some information about an individual dog, Mozzarella:
|
998 |
|
999 | <details>
|
1000 | <summary>View code 🐶</summary>
|
1001 |
|
1002 | ```tsx
|
1003 | function App() {
|
1004 | const [queryRef] = useBackgroundQuery(GET_BREEDS_QUERY);
|
1005 | return (
|
1006 | <Suspense fallback={<div>Loading...</div>}>
|
1007 | <Dog name="Mozzarella" queryRef={queryRef} />
|
1008 | </Suspense>
|
1009 | );
|
1010 | }
|
1011 |
|
1012 | function Dog({
|
1013 | name,
|
1014 | queryRef,
|
1015 | }: {
|
1016 | name: string;
|
1017 | queryRef: QueryReference<BreedData>;
|
1018 | }) {
|
1019 | const { data } = useSuspenseQuery(GET_DOG_QUERY, {
|
1020 | variables: { name },
|
1021 | });
|
1022 | return (
|
1023 | <>
|
1024 | Name: {data.dog.name}
|
1025 | <Suspense fallback={<div>Loading breeds...</div>}>
|
1026 | <Breeds queryRef={queryRef} />
|
1027 | </Suspense>
|
1028 | </>
|
1029 | );
|
1030 | }
|
1031 |
|
1032 | function Breeds({ queryRef }: { queryRef: QueryReference<BreedData> }) {
|
1033 | const { data } = useReadQuery(queryRef);
|
1034 | return data.breeds.map(({ characteristics }) =>
|
1035 | characteristics.map((characteristic) => (
|
1036 | <div key={characteristic}>{characteristic}</div>
|
1037 | ))
|
1038 | );
|
1039 | }
|
1040 | ```
|
1041 |
|
1042 | </details>
|
1043 |
|
1044 | For a detailed explanation of `useBackgroundQuery` and `useReadQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense).
|
1045 |
|
1046 | #### Document transforms 📑
|
1047 |
|
1048 | - [#10509](https://github.com/apollographql/apollo-client/pull/10509) [`79df2c7ba`](https://github.com/apollographql/apollo-client/commit/79df2c7ba55b7cfee69fd54024174f77099a2550) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to specify custom GraphQL document transforms. These transforms are run before reading data from the cache, before local state is resolved, and before the query document is sent through the link chain.
|
1049 |
|
1050 | To register a custom document transform, create a transform using the `DocumentTransform` class and pass it to the `documentTransform` option on `ApolloClient`.
|
1051 |
|
1052 | ```ts
|
1053 | import { DocumentTransform } from "@apollo/client";
|
1054 |
|
1055 | const documentTransform = new DocumentTransform((document) => {
|
1056 | // do something with `document`
|
1057 | return transformedDocument;
|
1058 | });
|
1059 |
|
1060 | const client = new ApolloClient({ documentTransform: documentTransform });
|
1061 | ```
|
1062 |
|
1063 | For more information on the behavior and API of `DocumentTransform`, see its [reference page in our documentation](https://www.apollographql.com/docs/react/data/document-transforms).
|
1064 |
|
1065 | #### New `removeTypenameFromVariables` link 🔗
|
1066 |
|
1067 | - [#10853](https://github.com/apollographql/apollo-client/pull/10853) [`300957960`](https://github.com/apollographql/apollo-client/commit/300957960a584920f2d346d29a0b3aaeb27d9489) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduce the new `removeTypenameFromVariables` link. This link will automatically remove `__typename` fields from `variables` for all operations. This link can be configured to exclude JSON-scalars for scalars that utilize `__typename`.
|
1068 |
|
1069 | This change undoes some work from [#10724](https://github.com/apollographql/apollo-client/pull/10724) where `__typename` was automatically stripped for all operations with no configuration. This was determined to be a breaking change and therefore moved into this link.
|
1070 |
|
1071 | For a detailed explanation of `removeTypenameFromVariables`, see its [API reference](https://www.apollographql.com/docs/react/api/link/apollo-link-remove-typename).
|
1072 |
|
1073 | #### New `skipToken` sentinel ⏭️
|
1074 |
|
1075 | - [#11112](https://github.com/apollographql/apollo-client/pull/11112) [`b4aefcfe9`](https://github.com/apollographql/apollo-client/commit/b4aefcfe97213461b9ce01946344e6a5e6d80704) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds support for a `skipToken` sentinel that can be used as `options` in `useSuspenseQuery` and `useBackgroundQuery` to skip execution of a query. This works identically to the `skip` option but is more type-safe and as such, becomes the recommended way to skip query execution. As such, the `skip` option has been deprecated in favor of `skipToken`.
|
1076 |
|
1077 | We are considering the removal of the `skip` option from `useSuspenseQuery` and `useBackgroundQuery` in the next major. We are releasing with it now to make migration from `useQuery` easier and make `skipToken` more discoverable.
|
1078 |
|
1079 | **`useSuspenseQuery`**
|
1080 |
|
1081 | ```ts
|
1082 | import { skipToken, useSuspenseQuery } from "@apollo/client";
|
1083 |
|
1084 | const id: number | undefined;
|
1085 |
|
1086 | const { data } = useSuspenseQuery(
|
1087 | query,
|
1088 | id ? { variables: { id } } : skipToken
|
1089 | );
|
1090 | ```
|
1091 |
|
1092 | **`useBackgroundQuery`**
|
1093 |
|
1094 | ```ts
|
1095 | import { skipToken, useBackgroundQuery } from "@apollo/client";
|
1096 |
|
1097 | function Parent() {
|
1098 | const [queryRef] = useBackgroundQuery(
|
1099 | query,
|
1100 | id ? { variables: { id } } : skipToken
|
1101 | );
|
1102 |
|
1103 | return queryRef ? <Child queryRef={queryRef} /> : null;
|
1104 | }
|
1105 |
|
1106 | function Child({ queryRef }: { queryRef: QueryReference<TData> }) {
|
1107 | const { data } = useReadQuery(queryRef);
|
1108 | }
|
1109 | ```
|
1110 |
|
1111 | For a detailed explanation of `skipToken`, see its [API reference](https://www.apollographql.com/docs/react/api/react/hooks/#skiptoken).
|
1112 |
|
1113 | #### New error extraction mechanism, smaller bundles 📉
|
1114 |
|
1115 | - [#10887](https://github.com/apollographql/apollo-client/pull/10887) [`f8c0b965d`](https://github.com/apollographql/apollo-client/commit/f8c0b965d49fb7d802371bb9cc3cb0b60cf05e5d) Thanks [@phryneas](https://github.com/phryneas)! - Add a new mechanism for Error Extraction to reduce bundle size by including error message texts on an opt-in basis.
|
1116 |
|
1117 | By default, errors will link to an error page with the entire error message.
|
1118 | This replaces "development" and "production" errors and works without
|
1119 | additional bundler configuration.
|
1120 |
|
1121 | Bundling the text of error messages and development warnings can be enabled as follows:
|
1122 |
|
1123 | ```js
|
1124 | import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
|
1125 | if (process.env.NODE_ENV !== "production") {
|
1126 | loadErrorMessages();
|
1127 | loadDevMessages();
|
1128 | }
|
1129 | ```
|
1130 |
|
1131 | For a detailed explanation, see our [reference on reducing bundle size](https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size).
|
1132 |
|
1133 | #### New `@nonreactive` directive 🎬
|
1134 |
|
1135 | - [#10722](https://github.com/apollographql/apollo-client/pull/10722) [`c7e60f83d`](https://github.com/apollographql/apollo-client/commit/c7e60f83dd1dfe07a1b6ce60d9675d3616a2ce66) Thanks [@benjamn](https://github.com/benjamn)! - Implement a `@nonreactive` directive for selectively skipping reactive comparisons of query result subtrees.
|
1136 |
|
1137 | The `@nonreactive` directive can be used to mark query fields or fragment spreads and is used to indicate that changes to the data contained within the subtrees marked `@nonreactive` should _not_ trigger re-rendering. This allows parent components to fetch data to be rendered by their children without re-rendering themselves when the data corresponding with fields marked as `@nonreactive` change.
|
1138 |
|
1139 | Consider an `App` component that fetches and renders a list of ski trails:
|
1140 |
|
1141 | <details>
|
1142 | <summary>View code 🎿</summary>
|
1143 |
|
1144 | ```jsx
|
1145 | const TrailFragment = gql`
|
1146 | fragment TrailFragment on Trail {
|
1147 | name
|
1148 | status
|
1149 | }
|
1150 | `;
|
1151 |
|
1152 | const ALL_TRAILS = gql`
|
1153 | query allTrails {
|
1154 | allTrails {
|
1155 | id
|
1156 | ...TrailFragment @nonreactive
|
1157 | }
|
1158 | }
|
1159 | ${TrailFragment}
|
1160 | `;
|
1161 |
|
1162 | function App() {
|
1163 | const { data, loading } = useQuery(ALL_TRAILS);
|
1164 | return (
|
1165 | <main>
|
1166 | <h2>Ski Trails</h2>
|
1167 | <ul>
|
1168 | {data?.trails.map((trail) => (
|
1169 | <Trail key={trail.id} id={trail.id} />
|
1170 | ))}
|
1171 | </ul>
|
1172 | </main>
|
1173 | );
|
1174 | }
|
1175 | ```
|
1176 |
|
1177 | </details>
|
1178 |
|
1179 | The `Trail` component renders a trail's name and status and allows the user to execute a mutation to toggle the status of the trail between `"OPEN"` and `"CLOSED"`:
|
1180 |
|
1181 | <details>
|
1182 | <summary>View code 🎿</summary>
|
1183 |
|
1184 | ```jsx
|
1185 | const Trail = ({ id }) => {
|
1186 | const [updateTrail] = useMutation(UPDATE_TRAIL);
|
1187 | const { data } = useFragment({
|
1188 | fragment: TrailFragment,
|
1189 | from: {
|
1190 | __typename: "Trail",
|
1191 | id,
|
1192 | },
|
1193 | });
|
1194 | return (
|
1195 | <li key={id}>
|
1196 | {data.name} - {data.status}
|
1197 | <input
|
1198 | checked={data.status === "OPEN" ? true : false}
|
1199 | type="checkbox"
|
1200 | onChange={(e) => {
|
1201 | updateTrail({
|
1202 | variables: {
|
1203 | trailId: id,
|
1204 | status: e.target.checked ? "OPEN" : "CLOSED",
|
1205 | },
|
1206 | });
|
1207 | }}
|
1208 | />
|
1209 | </li>
|
1210 | );
|
1211 | };
|
1212 | ```
|
1213 |
|
1214 | </details>
|
1215 |
|
1216 | Notice that the `Trail` component isn't receiving the entire `trail` object via props, only the `id` which is used along with the fragment document to create a live binding for each trail item in the cache. This allows each `Trail` component to react to the cache updates for a single trail independently. Updates to a trail's `status` will not cause the parent `App` component to rerender since the `@nonreactive` directive is applied to the `TrailFragment` spread, a fragment that includes the `status` field.
|
1217 |
|
1218 | For a detailed explanation, see our [`@nonreactive` reference](https://www.apollographql.com/docs/react/data/directives/#nonreactive) and [@alessbell](https://github.com/alessbell)'s [post on the Apollo blog about using `@nonreactive` with `useFragment`](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/).
|
1219 |
|
1220 | #### Abort the `AbortController` signal more granularly 🛑
|
1221 |
|
1222 | - [#11040](https://github.com/apollographql/apollo-client/pull/11040) [`125ef5b2a`](https://github.com/apollographql/apollo-client/commit/125ef5b2a8fd2de1515b2bdd71785ebab3596cb2) Thanks [@phryneas](https://github.com/phryneas)! - `HttpLink`/`BatchHttpLink`: Abort the `AbortController` signal more granularly.
|
1223 |
|
1224 | Before this change, when `HttpLink`/`BatchHttpLink` created an `AbortController` internally, the signal would always be `.abort`ed after the request was completed. This could cause issues with Sentry Session Replay and Next.js App Router Cache invalidations, which just replayed the fetch with the same options - including the cancelled `AbortSignal`.
|
1225 |
|
1226 | With this change, the `AbortController` will only be `.abort()`ed by outside events, not as a consequence of the request completing.
|
1227 |
|
1228 | #### `useFragment` drops its experimental label 🎓
|
1229 |
|
1230 | - [#10916](https://github.com/apollographql/apollo-client/pull/10916) [`ea75e18de`](https://github.com/apollographql/apollo-client/commit/ea75e18dec3db090dd4ed3b2d249bf674b90ead4) Thanks [@alessbell](https://github.com/alessbell)! - Remove experimental labels.
|
1231 |
|
1232 | `useFragment`, introduced in `3.7.0` as `useFragment_experimental`, is no longer an experimental API 🎉 We've removed the `_experimental` suffix from its named export and have made a number of improvements.
|
1233 |
|
1234 | For a detailed explanation, see our [`useFragment` reference](https://www.apollographql.com/docs/react/api/react/hooks#usefragment) and [@alessbell](https://github.com/alessbell)'s [post on the Apollo blog](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/) about using `useFragment` with `@nonreactive` for improved performance when rendering lists.
|
1235 |
|
1236 | <details>
|
1237 | <summary><h5><code>useFragment</code> improvements</h5></summary>
|
1238 |
|
1239 | - [#10765](https://github.com/apollographql/apollo-client/pull/10765) [`35f36c5aa`](https://github.com/apollographql/apollo-client/commit/35f36c5aaefe1f215044e09fdf9386042bc59dd2) Thanks [@phryneas](https://github.com/phryneas)! - More robust types for the `data` property on `UseFragmentResult`. When a partial result is given, the type is now correctly set to `Partial<TData>`.
|
1240 |
|
1241 | - [#11083](https://github.com/apollographql/apollo-client/pull/11083) [`f766e8305`](https://github.com/apollographql/apollo-client/commit/f766e8305d9f2dbde59a61b8e70c99c4b2b67d55) Thanks [@phryneas](https://github.com/phryneas)! - Adjust the rerender timing of `useQuery` to more closely align with `useFragment`. This means that cache updates delivered to both hooks should trigger renders at relatively the same time. Previously, the `useFragment` might rerender much faster leading to some confusion.
|
1242 |
|
1243 | - [#10836](https://github.com/apollographql/apollo-client/pull/10836) [`6794893c2`](https://github.com/apollographql/apollo-client/commit/6794893c29cc945aa99f6fe54a9e4e70ec3e57fd) Thanks [@phryneas](https://github.com/phryneas)! - Remove the deprecated `returnPartialData` option from `useFragment` hook.
|
1244 |
|
1245 | </details>
|
1246 |
|
1247 | <details open>
|
1248 | <summary><h4>More Minor Changes</h4></summary>
|
1249 |
|
1250 | - [#10895](https://github.com/apollographql/apollo-client/pull/10895) [`e187866fd`](https://github.com/apollographql/apollo-client/commit/e187866fdfbbd1e1e30646f289367fb4b5afb3c3) Thanks [@Gelio](https://github.com/Gelio)! - Add generic type parameter for the entity modified in `cache.modify`. Improves TypeScript type inference for that type's fields and values of those fields.
|
1251 |
|
1252 | Example:
|
1253 |
|
1254 | ```ts
|
1255 | cache.modify<Book>({
|
1256 | id: cache.identify(someBook),
|
1257 | fields: {
|
1258 | title: (title) => {
|
1259 | // title has type `string`.
|
1260 | // It used to be `any`.
|
1261 | },
|
1262 | => {
|
1263 | // author has type `Reference | Book["author"]`.
|
1264 | // It used to be `any`.
|
1265 | },
|
1266 | },
|
1267 | });
|
1268 | ```
|
1269 |
|
1270 | - [#10895](https://github.com/apollographql/apollo-client/pull/10895) [`e187866fd`](https://github.com/apollographql/apollo-client/commit/e187866fdfbbd1e1e30646f289367fb4b5afb3c3) Thanks [@Gelio](https://github.com/Gelio)! - Use unique opaque types for the `DELETE` and `INVALIDATE` Apollo cache modifiers.
|
1271 |
|
1272 | This increases type safety, since these 2 modifiers no longer have the `any` type. Moreover, it no longer triggers [the `@typescript-eslint/no-unsafe-return`
|
1273 | rule](https://typescript-eslint.io/rules/no-unsafe-return/).
|
1274 |
|
1275 | - [#10340](https://github.com/apollographql/apollo-client/pull/10340) [`4f73c5ca1`](https://github.com/apollographql/apollo-client/commit/4f73c5ca15d367aa23f02018d062f221c4506a4d) Thanks [@alessbell](https://github.com/alessbell)! - Avoid calling `useQuery` `onCompleted` for cache writes
|
1276 |
|
1277 | - [#10527](https://github.com/apollographql/apollo-client/pull/10527) [`0cc7e2e19`](https://github.com/apollographql/apollo-client/commit/0cc7e2e194f84e137a502395f26acdaef392ecae) Thanks [@phryneas](https://github.com/phryneas)! - Remove the `query`/`mutation`/`subscription` option from hooks that already take that value as their first argument.
|
1278 |
|
1279 | - [#10506](https://github.com/apollographql/apollo-client/pull/10506) [`2dc2e1d4f`](https://github.com/apollographql/apollo-client/commit/2dc2e1d4f77318d8a4c29445344b4f8c5b08b7e3) Thanks [@phryneas](https://github.com/phryneas)! - prevent accidental widening of inferred `TData` and `TVariables` generics for query hook option arguments
|
1280 |
|
1281 | - [#10521](https://github.com/apollographql/apollo-client/pull/10521) [`fbf729414`](https://github.com/apollographql/apollo-client/commit/fbf729414b6322a84158d9864bdfb5b17b2c7d77) Thanks [@benjamn](https://github.com/benjamn)! - Simplify `__DEV__` polyfill to use imports instead of global scope
|
1282 |
|
1283 | - [#10994](https://github.com/apollographql/apollo-client/pull/10994) [`2ebbd3abb`](https://github.com/apollographql/apollo-client/commit/2ebbd3abb31224ed383896ebea7c2791c9b42a22) Thanks [@phryneas](https://github.com/phryneas)! - Add .js file extensions to imports in src and dist/\*_/_.d.ts
|
1284 |
|
1285 | - [#11045](https://github.com/apollographql/apollo-client/pull/11045) [`9c1d4a104`](https://github.com/apollographql/apollo-client/commit/9c1d4a104d721993b5b306ca4c21724a974e098d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - When changing variables back to a previously used set of variables, do not automatically cache the result as part of the query reference. Instead, dispose of the query reference so that the `InMemoryCache` can determine the cached behavior. This means that fetch policies that would guarantee a network request are now honored when switching back to previously used variables.
|
1286 |
|
1287 | - [#11058](https://github.com/apollographql/apollo-client/pull/11058) [`89bf33c42`](https://github.com/apollographql/apollo-client/commit/89bf33c425d08880eeaed4584bdd56c4caf085e7) Thanks [@phryneas](https://github.com/phryneas)! - (Batch)HttpLink: Propagate `AbortError`s to the user when a user-provided `signal` is passed to the link. Previously, these links would swallow all `AbortErrors`, potentially causing queries and mutations to never resolve. As a result of this change, users are now expected to handle `AbortError`s when passing in a user-provided `signal`.
|
1288 |
|
1289 | - [#10346](https://github.com/apollographql/apollo-client/pull/10346) [`3bcfc42d3`](https://github.com/apollographql/apollo-client/commit/3bcfc42d394b6a97900495eacdaf58c31ae96d9f) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to allow `@client` fields to be sent to the link chain.
|
1290 |
|
1291 | - [#10567](https://github.com/apollographql/apollo-client/pull/10567) [`c2ce6496c`](https://github.com/apollographql/apollo-client/commit/c2ce6496c10e7ae7e29d25161c2d3cef3e2c6144) Thanks [@benjamn](https://github.com/benjamn)! - Allow `ApolloCache` implementations to specify default value for `assumeImmutableResults` client option, improving performance for applications currently using `InMemoryCache` without configuring `new ApolloClient({ assumeImmutableResults: true })`
|
1292 |
|
1293 | - [#10915](https://github.com/apollographql/apollo-client/pull/10915) [`3a62d8228`](https://github.com/apollographql/apollo-client/commit/3a62d8228ab6c15cdb7cd4ea106d13ba3e6f0029) Thanks [@phryneas](https://github.com/phryneas)! - Changes how development-only code is bundled in the library to more reliably enable consuming bundlers to reduce production bundle sizes while keeping compatibility with non-node environments.
|
1294 |
|
1295 | </details>
|
1296 |
|
1297 | <details open>
|
1298 | <summary><h3>Patch Changes</h3></summary>
|
1299 |
|
1300 | - [#11086](https://github.com/apollographql/apollo-client/pull/11086) [`0264fee06`](https://github.com/apollographql/apollo-client/commit/0264fee066cb715602eda26c7c0bb1254469eccb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a call to `refetch`, `fetchMore`, or changing `skip` to `false` that returned a result deeply equal to data in the cache would get stuck in a pending state and never resolve.
|
1301 |
|
1302 | - [#11053](https://github.com/apollographql/apollo-client/pull/11053) [`c0ca70720`](https://github.com/apollographql/apollo-client/commit/c0ca70720cf5fbedd6e4f128b460c1995d9c55a7) Thanks [@phryneas](https://github.com/phryneas)! - Add `SuspenseCache` as a lazy hidden property on ApolloClient.
|
1303 | This means that `SuspenseCache` is now an implementation details of Apollo Client and you no longer need to manually instantiate it and no longer need to pass it into `ApolloProvider`. Trying to instantiate a `SuspenseCache` instance in your code will now throw an error.
|
1304 |
|
1305 | - [#11115](https://github.com/apollographql/apollo-client/pull/11115) [`78739e3ef`](https://github.com/apollographql/apollo-client/commit/78739e3efe86f6db959dd792d21fa12e0427b12c) Thanks [@phryneas](https://github.com/phryneas)! - Enforce `export type` for all type-level exports.
|
1306 |
|
1307 | - [#11027](https://github.com/apollographql/apollo-client/pull/11027) [`e47cfd04e`](https://github.com/apollographql/apollo-client/commit/e47cfd04ec50cb4c19828f4d655eb0f989cdcf7d) Thanks [@phryneas](https://github.com/phryneas)! - Prevents the DevTool installation warning to be turned into a documentation link.
|
1308 |
|
1309 | - [#10594](https://github.com/apollographql/apollo-client/pull/10594) [`f221b5e8f`](https://github.com/apollographql/apollo-client/commit/f221b5e8fafef3970af2037218c2396ae7db505e) Thanks [@phryneas](https://github.com/phryneas)! - Add a `suspenseCache` option to `useSuspenseQuery`
|
1310 |
|
1311 | - [#10700](https://github.com/apollographql/apollo-client/pull/10700) [`12e37f46f`](https://github.com/apollographql/apollo-client/commit/12e37f46f17f0d5a6d408b89ebafbf7413f309ab) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a `queryKey` option to `useSuspenseQuery` that allows the hook to create a unique subscription instance.
|
1312 |
|
1313 | - [#10724](https://github.com/apollographql/apollo-client/pull/10724) [`e285dfd00`](https://github.com/apollographql/apollo-client/commit/e285dfd003c7074383732ee23e539d7a0316af10) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Automatically strips `__typename` fields from `variables` sent to the server when using [`HttpLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-http), [`BatchHttpLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-batch-http), or [`GraphQLWsLink`](https://www.apollographql.com/docs/react/api/link/apollo-link-subscriptions). This allows GraphQL data returned from a query to be used as an argument to a subsequent GraphQL operation without the need to strip the `__typename` in user-space.
|
1314 |
|
1315 | - [#10957](https://github.com/apollographql/apollo-client/pull/10957) [`445164d21`](https://github.com/apollographql/apollo-client/commit/445164d2177efe46637a514afa6a88502d3de10f) Thanks [@phryneas](https://github.com/phryneas)! - Use `React.version` as key for shared Contexts.
|
1316 |
|
1317 | - [#10635](https://github.com/apollographql/apollo-client/pull/10635) [`7df51ee19`](https://github.com/apollographql/apollo-client/commit/7df51ee19a49a92f48c0f58f91894d32091cb294) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where cache updates would not propagate to `useSuspenseQuery` while in strict mode.
|
1318 |
|
1319 | - [#11013](https://github.com/apollographql/apollo-client/pull/11013) [`5ed2cfdaf`](https://github.com/apollographql/apollo-client/commit/5ed2cfdaf9030550d4c82200a5a690b112ad3335) Thanks [@alessbell](https://github.com/alessbell)! - Make private fields `inFlightLinkObservables` and `fetchCancelFns` protected in QueryManager in order to make types available in [`@apollo/experimental-nextjs-app-support`](https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support) package when extending the `ApolloClient` class.
|
1320 |
|
1321 | - [#10869](https://github.com/apollographql/apollo-client/pull/10869) [`ba1d06166`](https://github.com/apollographql/apollo-client/commit/ba1d0616618ee040e9bcb20874b03d5783f7eff3) Thanks [@phryneas](https://github.com/phryneas)! - Ensure Context value stability when rerendering ApolloProvider with the same `client` and/or `suspenseCache` prop
|
1322 |
|
1323 | - [#11103](https://github.com/apollographql/apollo-client/pull/11103) [`e3d611daf`](https://github.com/apollographql/apollo-client/commit/e3d611daf7a014e5c92d6bed75d67b9187437eda) Thanks [@caylahamann](https://github.com/caylahamann)! - Fixes a bug in `useMutation` so that `onError` is called when an error is returned from the request with `errorPolicy` set to 'all' .
|
1324 |
|
1325 | - [#10657](https://github.com/apollographql/apollo-client/pull/10657) [`db305a800`](https://github.com/apollographql/apollo-client/commit/db305a8005664e9b6ec64046da230f41d293104d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Return `networkStatus` in the `useSuspenseQuery` result.
|
1326 |
|
1327 | - [#10937](https://github.com/apollographql/apollo-client/pull/10937) [`eea44eb87`](https://github.com/apollographql/apollo-client/commit/eea44eb87f6f296a6f9978d6ba1cf36e899c9131) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Moves `DocumentTransform` to the `utilities` sub-package to avoid a circular dependency between the `core` and `cache` sub-packages.
|
1328 |
|
1329 | - [#10951](https://github.com/apollographql/apollo-client/pull/10951) [`2e833b2ca`](https://github.com/apollographql/apollo-client/commit/2e833b2cacb71fc2050cb3976d0bbe710baeedff) Thanks [@alessbell](https://github.com/alessbell)! - Improve `useBackgroundQuery` type interface
|
1330 |
|
1331 | - [#10651](https://github.com/apollographql/apollo-client/pull/10651) [`8355d0e1e`](https://github.com/apollographql/apollo-client/commit/8355d0e1e9c1cee58cabd7df68d3ba09a3afaf6c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixes an issue where `useSuspenseQuery` would not respond to cache updates when using a cache-first `fetchPolicy` after the hook was mounted with data already in the cache.
|
1332 |
|
1333 | - [#11026](https://github.com/apollographql/apollo-client/pull/11026) [`b8d405eee`](https://github.com/apollographql/apollo-client/commit/b8d405eee2a81df92861be5abd9bd874d7cad111) Thanks [@phryneas](https://github.com/phryneas)! - Store React.Context instance mapped by React.createContext instance, not React.version.
|
1334 | Using `React.version` can cause problems with `preact`, as multiple versions of `preact` will all identify themselves as React `17.0.2`.
|
1335 |
|
1336 | - [#11000](https://github.com/apollographql/apollo-client/pull/11000) [`1d43ab616`](https://github.com/apollographql/apollo-client/commit/1d43ab6169b2b2ebfd8f86366212667f9609f5f5) Thanks [@phryneas](https://github.com/phryneas)! - Use `import * as React` everywhere. This prevents an error when importing `@apollo/client` in a React Server component. (see [#10974](https://github.com/apollographql/apollo-client/issues/10974))
|
1337 |
|
1338 | - [#10852](https://github.com/apollographql/apollo-client/pull/10852) [`27fbdb3f9`](https://github.com/apollographql/apollo-client/commit/27fbdb3f9003cc304d26987cb38daf10910f2da6) Thanks [@phryneas](https://github.com/phryneas)! - Chore: Add ESLint rule for consistent type imports, apply autofix
|
1339 |
|
1340 | - [#10999](https://github.com/apollographql/apollo-client/pull/10999) [`c1904a78a`](https://github.com/apollographql/apollo-client/commit/c1904a78abb186f475303d632c2cb303bbd8d4f9) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug in `QueryReference` where `this.resolve` or `this.reject` might be executed even if `undefined`.
|
1341 |
|
1342 | - [#10940](https://github.com/apollographql/apollo-client/pull/10940) [`1d38f128f`](https://github.com/apollographql/apollo-client/commit/1d38f128f325ea7092bd04fe3799ebbb6e8bdfdd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for the `skip` option in `useBackgroundQuery` and `useSuspenseQuery`. Setting this option to `true` will avoid a network request.
|
1343 |
|
1344 | - [#10672](https://github.com/apollographql/apollo-client/pull/10672) [`932252b0c`](https://github.com/apollographql/apollo-client/commit/932252b0c54792ec8c5095de1b42c005a91ffe6d) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix the compatibility between `useSuspenseQuery` and React's `useDeferredValue` and `startTransition` APIs to allow React to show stale UI while the changes to the variable cause the component to suspend.
|
1345 |
|
1346 | #### Breaking change
|
1347 |
|
1348 | `nextFetchPolicy` support has been removed from `useSuspenseQuery`. If you are using this option, remove it, otherwise it will be ignored.
|
1349 |
|
1350 | - [#10964](https://github.com/apollographql/apollo-client/pull/10964) [`f33171506`](https://github.com/apollographql/apollo-client/commit/f331715066d65291b1f5df5e6fa2b6618dfc70b1) Thanks [@alessbell](https://github.com/alessbell)! - Fixes a bug in `BatchHttpLink` that removed variables from all requests by default.
|
1351 |
|
1352 | - [#10633](https://github.com/apollographql/apollo-client/pull/10633) [`90a06eeeb`](https://github.com/apollographql/apollo-client/commit/90a06eeeb5a50eb172f5c6211693ea051897d8f3) Thanks [@benjamn](https://github.com/benjamn)! - Fix type policy inheritance involving fuzzy `possibleTypes`
|
1353 |
|
1354 | - [#10754](https://github.com/apollographql/apollo-client/pull/10754) [`64b304862`](https://github.com/apollographql/apollo-client/commit/64b3048621de35bbfe9bdf47785a2d5583232830) Thanks [@sincraianul](https://github.com/sincraianul)! - Fix `includeUnusedVariables` option not working with `BatchHttpLink`
|
1355 |
|
1356 | - [#11018](https://github.com/apollographql/apollo-client/pull/11018) [`5618953f3`](https://github.com/apollographql/apollo-client/commit/5618953f332a10c7df1b385126ec714aa5809c48) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `useBackgroundQuery` now uses its own options type called `BackgroundQueryHookOptions` rather than reusing `SuspenseQueryHookOptions`.
|
1357 |
|
1358 | - [#11035](https://github.com/apollographql/apollo-client/pull/11035) [`a3ab7456d`](https://github.com/apollographql/apollo-client/commit/a3ab7456d59be4a7beb58d0aff6d431c603448f5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Incrementally re-render deferred queries after calling `refetch` or setting `skip` to `false` to match the behavior of the initial fetch. Previously, the hook would not re-render until the entire result had finished loading in these cases.
|
1359 |
|
1360 | - [#10399](https://github.com/apollographql/apollo-client/pull/10399) [`652a1ae08`](https://github.com/apollographql/apollo-client/commit/652a1ae0868e4a5b75b9ff656d26f57eeca1081a) Thanks [@alessbell](https://github.com/alessbell)! - Silence useLayoutEffect warning when useSuspenseQuery runs on server
|
1361 |
|
1362 | - [#10919](https://github.com/apollographql/apollo-client/pull/10919) [`f796ce1ac`](https://github.com/apollographql/apollo-client/commit/f796ce1ac72f31a951a1d0f0b78d19dd039a6398) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue when using a link that relied on `operation.getContext` and `operation.setContext` would error out when it was declared after the `removeTypenameFromVariables` link.
|
1363 |
|
1364 | - [#10968](https://github.com/apollographql/apollo-client/pull/10968) [`b102390b2`](https://github.com/apollographql/apollo-client/commit/b102390b238e5ce083062541d98a00fc3a10e1e1) Thanks [@phryneas](https://github.com/phryneas)! - Use printed query for query deduplication. Cache `print` calls for GraphQL documents to speed up repeated operations.
|
1365 |
|
1366 | - [#11071](https://github.com/apollographql/apollo-client/pull/11071) [`4473e925a`](https://github.com/apollographql/apollo-client/commit/4473e925ac5d6a53dc2b34867f034eda1b05aa00) Thanks [@jerelmiller](https://github.com/jerelmiller)! - [#10509](https://github.com/apollographql/apollo-client/pull/10509) introduced some helpers for determining the type of operation for a GraphQL query. This imported the `OperationTypeNode` from graphql-js which is not available in GraphQL 14. To maintain compatibility with graphql-js v14, this has been reverted to use plain strings.
|
1367 |
|
1368 | - [#10766](https://github.com/apollographql/apollo-client/pull/10766) [`ffb179e55`](https://github.com/apollographql/apollo-client/commit/ffb179e5553fa6f9156ae0aaf782dfcbec7d08c7) Thanks [@jerelmiller](https://github.com/jerelmiller)! - More robust typings for the `data` property returned from `useSuspenseQuery` when using `returnPartialData: true` or an `errorPolicy` of `all` or `ignore`. `TData` now defaults to `unknown` instead of `any`.
|
1369 |
|
1370 | - [#10401](https://github.com/apollographql/apollo-client/pull/10401) [`3e5b41a75`](https://github.com/apollographql/apollo-client/commit/3e5b41a751673bb2120c0b624e22afd3b7b860e5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Always throw network errors in `useSuspenseQuery` regardless of the set `errorPolicy`.
|
1371 |
|
1372 | - [#10877](https://github.com/apollographql/apollo-client/pull/10877) [`f40248598`](https://github.com/apollographql/apollo-client/commit/f402485985cc2551b51602c0bff213b7ffb856b9) Thanks [@phryneas](https://github.com/phryneas)! - Change an import in `useQuery` and `useMutation` that added an unnecessary runtime dependency on `@apollo/client/core`. This drastically reduces the bundle size of each the hooks.
|
1373 |
|
1374 | - [#10656](https://github.com/apollographql/apollo-client/pull/10656) [`54c4d2f3c`](https://github.com/apollographql/apollo-client/commit/54c4d2f3c719654e38e537ec38f1cb415c7c3f58) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure `refetch`, `fetchMore`, and `subscribeToMore` functions returned by `useSuspenseQuery` are referentially stable between renders, even as `data` is updated.
|
1375 |
|
1376 | - [#10324](https://github.com/apollographql/apollo-client/pull/10324) [`95eb228be`](https://github.com/apollographql/apollo-client/commit/95eb228bedc193a520604e351d1c455bfbedef06) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add `@defer` support to `useSuspenseQuery`.
|
1377 |
|
1378 | - [#10888](https://github.com/apollographql/apollo-client/pull/10888) [`1562a2f5a`](https://github.com/apollographql/apollo-client/commit/1562a2f5a91cf577d9c89c4e84088a6bccc73c28) Thanks [@alessbell](https://github.com/alessbell)! - Updates dependency versions in `package.json` by bumping:
|
1379 |
|
1380 | - `@wry/context` to `^0.7.3`
|
1381 | - `@wry/equality` to `^0.5.6`
|
1382 | - `@wry/trie` to `^0.4.3`
|
1383 | - `optimism` to `^0.17.4`
|
1384 |
|
1385 | to 1. [fix sourcemap warnings](https://github.com/benjamn/wryware/pull/497) and 2. a Codesandbox [sandpack (in-browser) bundler transpilation bug](https://github.com/codesandbox/sandpack/issues/940) with an [upstream optimism workaround](https://github.com/benjamn/optimism/pull/550).
|
1386 |
|
1387 | - [#11010](https://github.com/apollographql/apollo-client/pull/11010) [`1051a9c88`](https://github.com/apollographql/apollo-client/commit/1051a9c888ba86511b7fcb80a26d3b3050359258) Thanks [@alessbell](https://github.com/alessbell)! - Hide queryRef in a Symbol in `useBackgroundQuery`s return value.
|
1388 |
|
1389 | - [#10758](https://github.com/apollographql/apollo-client/pull/10758) [`9def7421f`](https://github.com/apollographql/apollo-client/commit/9def7421f3d028c91fcaa7971878b3da8281424d) Thanks [@phryneas](https://github.com/phryneas)! - use `React.use` where available
|
1390 |
|
1391 | - [#11032](https://github.com/apollographql/apollo-client/pull/11032) [`6a4da900a`](https://github.com/apollographql/apollo-client/commit/6a4da900a1bc5da3524caabd64bb30945e66f675) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Throw errors in `useSuspenseQuery` for errors returned in incremental chunks when `errorPolicy` is `none`. This provides a more consistent behavior of the `errorPolicy` in the hook.
|
1392 |
|
1393 | #### Potentially breaking change
|
1394 |
|
1395 | Previously, if you issued a query with `@defer` and relied on `errorPolicy: 'none'` to set the `error` property returned from `useSuspenseQuery` when the error was returned in an incremental chunk, this error is now thrown. Switch the `errorPolicy` to `all` to avoid throwing the error and instead return it in the `error` property.
|
1396 |
|
1397 | - [#10960](https://github.com/apollographql/apollo-client/pull/10960) [`ee407ef97`](https://github.com/apollographql/apollo-client/commit/ee407ef97317bf29c554732237aaf11552e06b01) Thanks [@alessbell](https://github.com/alessbell)! - Adds support for `returnPartialData` and `refetchWritePolicy` options in `useBackgroundQuery` hook.
|
1398 |
|
1399 | - [#10809](https://github.com/apollographql/apollo-client/pull/10809) [`49d28f764`](https://github.com/apollographql/apollo-client/commit/49d28f764980d132089ef8f6beca6e766b6120c0) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fixed the ability to use `refetch` and `fetchMore` with React's `startTransition`. The hook will now behave correctly by allowing React to avoid showing the Suspense fallback when these functions are wrapped by `startTransition`. This change deprecates the `suspensePolicy` option in favor of `startTransition`.
|
1400 |
|
1401 | - [#11082](https://github.com/apollographql/apollo-client/pull/11082) [`0f1cde3a2`](https://github.com/apollographql/apollo-client/commit/0f1cde3a207699edb742dfaada817a815488d594) Thanks [@phryneas](https://github.com/phryneas)! - Restore Apollo Client 3.7 `getApolloContext` behaviour
|
1402 |
|
1403 | - [#10969](https://github.com/apollographql/apollo-client/pull/10969) [`525a9317a`](https://github.com/apollographql/apollo-client/commit/525a9317af729309f699fd6f8b787647a5f63eac) Thanks [@phryneas](https://github.com/phryneas)! - Slightly decrease bundle size and memory footprint of `SuspenseCache` by changing how cache entries are stored internally.
|
1404 |
|
1405 | - [#11025](https://github.com/apollographql/apollo-client/pull/11025) [`6092b6edf`](https://github.com/apollographql/apollo-client/commit/6092b6edf67ef311954c18c778ed0bdca1b77258) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `useSuspenseQuery` and `useBackgroundQuery` will now properly apply changes to its options between renders.
|
1406 |
|
1407 | - [#10872](https://github.com/apollographql/apollo-client/pull/10872) [`96b4f8837`](https://github.com/apollographql/apollo-client/commit/96b4f8837881db67e951272b775dc62282e50d49) Thanks [@phryneas](https://github.com/phryneas)! - The "per-React-Version-Singleton" ApolloContext is now stored on `globalThis`, not `React.createContext`, and throws an error message when accessed from React Server Components.
|
1408 |
|
1409 | - [#10450](https://github.com/apollographql/apollo-client/pull/10450) [`f8bc33387`](https://github.com/apollographql/apollo-client/commit/f8bc33387f66e28456aede53bae75694c9a7a45f) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for the `subscribeToMore` and `client` fields returned in the `useSuspenseQuery` result.
|
1410 |
|
1411 | </details>
|
1412 |
|
1413 | ## 3.7.17
|
1414 |
|
1415 | ### Patch Changes
|
1416 |
|
1417 | - [#10631](https://github.com/apollographql/apollo-client/pull/10631) [`b93388d75`](https://github.com/apollographql/apollo-client/commit/b93388d7582d88859c4975dff524c1ceb5bd2b4e) Thanks [@phryneas](https://github.com/phryneas)! - ObservableQuery.getCurrentResult: skip the cache if the running query should not access the cache
|
1418 |
|
1419 | ## 3.7.16
|
1420 |
|
1421 | ### Patch Changes
|
1422 |
|
1423 | - [#10806](https://github.com/apollographql/apollo-client/pull/10806) [`cb1540504`](https://github.com/apollographql/apollo-client/commit/cb15405041e0bd644fcf23d1b8fcaa09762c5a6a) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug in `PersistedQueryLink` that would cause it to permanently skip persisted queries after a 400 or 500 status code.
|
1424 |
|
1425 | - [#10807](https://github.com/apollographql/apollo-client/pull/10807) [`b32369592`](https://github.com/apollographql/apollo-client/commit/b3236959269ce27b18b8c2cae72106098a3ba1b8) Thanks [@phryneas](https://github.com/phryneas)! - `PersistedQueryLink` will now also check for error codes in `extensions`.
|
1426 |
|
1427 | - [#10982](https://github.com/apollographql/apollo-client/pull/10982) [`b9be7a814`](https://github.com/apollographql/apollo-client/commit/b9be7a814a64fc6b3e6ce23dd97a4f0c7140aba7) Thanks [@sdeleur-sc](https://github.com/sdeleur-sc)! - Update `relayStylePagination` to avoid populating `startCursor` when only a single cursor is present under the `edges` field. Use that cursor only as the `endCursor`.
|
1428 |
|
1429 | - [#10962](https://github.com/apollographql/apollo-client/pull/10962) [`772cfa3cb`](https://github.com/apollographql/apollo-client/commit/772cfa3cb563dccee878177e58c8250c4e5b5013) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `useGETForQueries` option in `BatchHttpLink.Options` type since it is not supported.
|
1430 |
|
1431 | ## 3.7.15
|
1432 |
|
1433 | ### Patch Changes
|
1434 |
|
1435 | - [#10891](https://github.com/apollographql/apollo-client/pull/10891) [`ab42a5c08`](https://github.com/apollographql/apollo-client/commit/ab42a5c08840193cb915f4e66d71fac3834fec68) Thanks [@laverdet](https://github.com/laverdet)! - Fixes a bug in how multipart responses are read when using `@defer`. When reading a multipart body, `HttpLink` no longer attempts to parse the boundary (e.g. `"---"` or other boundary string) within the response data itself, only when reading the beginning of each mulitpart chunked message.
|
1436 |
|
1437 | - [#10789](https://github.com/apollographql/apollo-client/pull/10789) [`23a4e1578`](https://github.com/apollographql/apollo-client/commit/23a4e15786fe99658d741585366f3b02bcffb97f) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where other fields could be aliased to `__typename` or `id`, in which case an incoming result would be merged into the wrong cache entry.
|
1438 |
|
1439 | ## 3.7.14
|
1440 |
|
1441 | ### Patch Changes
|
1442 |
|
1443 | - [#10764](https://github.com/apollographql/apollo-client/pull/10764) [`1b0a61fe5`](https://github.com/apollographql/apollo-client/commit/1b0a61fe5a6593f319da26fec8692359232ccf9b) Thanks [@phryneas](https://github.com/phryneas)! - Deprecate `useFragment` `returnPartialData` option
|
1444 |
|
1445 | - [#10810](https://github.com/apollographql/apollo-client/pull/10810) [`a6252774f`](https://github.com/apollographql/apollo-client/commit/a6252774f43fd9a4be9c50b48b7a6d5a1c8e64ec) Thanks [@dleavitt](https://github.com/dleavitt)! - Fix type signature of `ServerError`.
|
1446 |
|
1447 | In <3.7 `HttpLink` and `BatchHttpLink` would return a `ServerError.message` of e.g. `"Unexpected token 'E', \"Error! Foo bar\" is not valid JSON"` and a `ServerError.result` of `undefined` in the case where a server returned a >= 300 response code with a response body containing a string that could not be parsed as JSON.
|
1448 |
|
1449 | In >=3.7, `message` became e.g. `Response not successful: Received status code 302` and `result` became the string from the response body, however the type in `ServerError.result` was not updated to include the `string` type, which is now properly reflected.
|
1450 |
|
1451 | ## 3.7.13
|
1452 |
|
1453 | ### Patch Changes
|
1454 |
|
1455 | - [#10805](https://github.com/apollographql/apollo-client/pull/10805) [`a5503666c`](https://github.com/apollographql/apollo-client/commit/a5503666c2cc8220ac1d877e3296556e54e58ff6) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential memory leak in SSR scenarios when many `persistedQuery` instances were created over time.
|
1456 |
|
1457 | - [#10718](https://github.com/apollographql/apollo-client/pull/10718) [`577c68bdd`](https://github.com/apollographql/apollo-client/commit/577c68bdd26519f8341fd1188ea4b8aabe357856) Thanks [@Hsifnus](https://github.com/Hsifnus)! - Delay Concast subscription teardown slightly in `useSubscription` to prevent unexpected Concast teardown when one `useSubscription` hook tears down its in-flight Concast subscription immediately followed by another `useSubscription` hook reusing and subscribing to that same Concast
|
1458 |
|
1459 | ## 3.7.12
|
1460 |
|
1461 | ### Patch Changes
|
1462 |
|
1463 | - [#10735](https://github.com/apollographql/apollo-client/pull/10735) [`895bcdcff`](https://github.com/apollographql/apollo-client/commit/895bcdcff146bc4575c8f3423c30fa9e885be16b) Thanks [@alessbell](https://github.com/alessbell)! - If a multipart chunk contains only `hasNext: false`, immediately complete the observable.
|
1464 |
|
1465 | ## 3.7.11
|
1466 |
|
1467 | ### Patch Changes
|
1468 |
|
1469 | - [#10586](https://github.com/apollographql/apollo-client/pull/10586) [`4175af594`](https://github.com/apollographql/apollo-client/commit/4175af59419dbb698c32c074f44229f3a5b3b83d) Thanks [@alessbell](https://github.com/alessbell)! - Improve WebSocket error handling for generic `Event` received on error. For more information see [https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event).
|
1470 |
|
1471 | - [#10411](https://github.com/apollographql/apollo-client/pull/10411) [`152baac34`](https://github.com/apollographql/apollo-client/commit/152baac343b8b68c7a2d4691d5dc60d9e43e62bb) Thanks [@lovasoa](https://github.com/lovasoa)! - Simplify error message generation and make 'undefined' an impossible message string.
|
1472 |
|
1473 | - [#10592](https://github.com/apollographql/apollo-client/pull/10592) [`cdb98ae08`](https://github.com/apollographql/apollo-client/commit/cdb98ae082ae4c7da6cd6a0fd5ad8457810fceda) Thanks [@alessbell](https://github.com/alessbell)! - Adds support for multipart subscriptions in `HttpLink`.
|
1474 |
|
1475 | - [#10698](https://github.com/apollographql/apollo-client/pull/10698) [`38508a251`](https://github.com/apollographql/apollo-client/commit/38508a251423057fd8a0df50230f50e0a5dde5fd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Changes the behavior of `useLazyQuery` introduced in [#10427](https://github.com/apollographql/apollo-client/pull/10427) where unmounting a component before a query was resolved would reject the promise with an abort error. Instead, the promise will now resolve naturally with the result from the request.
|
1476 |
|
1477 | Other notable fixes:
|
1478 |
|
1479 | - Kicking off multiple requests in parallel with the execution function will now ensure each returned promise is resolved with the data from its request. Previously, each promise was resolved with data from the last execution.
|
1480 | - Re-rendering `useLazyQuery` with a different query document will now ensure the execution function uses the updated query document. Previously, only the query document rendered the first time would be used for the request.
|
1481 |
|
1482 | - [#10660](https://github.com/apollographql/apollo-client/pull/10660) [`364bee98f`](https://github.com/apollographql/apollo-client/commit/364bee98fe193a7915664c1a5b206fd52793f85a) Thanks [@alessbell](https://github.com/alessbell)! - Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users.
|
1483 |
|
1484 | - [#10597](https://github.com/apollographql/apollo-client/pull/10597) [`8fb9d190d`](https://github.com/apollographql/apollo-client/commit/8fb9d190dbf48147412517643e3e425a7d48c49c) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where an incoming cache update could prevent future updates from the active link.
|
1485 |
|
1486 | - [#10629](https://github.com/apollographql/apollo-client/pull/10629) [`02605bb3c`](https://github.com/apollographql/apollo-client/commit/02605bb3c9e148bf87a6e52b4a9ecc7d523ef9f6) Thanks [@phryneas](https://github.com/phryneas)! - `useQuery`: delay unsubscribe to fix race conditions
|
1487 |
|
1488 | ## 3.7.10
|
1489 |
|
1490 | ### Patch Changes
|
1491 |
|
1492 | - [#9438](https://github.com/apollographql/apollo-client/pull/9438) [`52a9c8ea1`](https://github.com/apollographql/apollo-client/commit/52a9c8ea1ac08ee53fe1ddbd4ded899ea00a1f9f) Thanks [@dciesielkiewicz](https://github.com/dciesielkiewicz)! - Ensure the `client` option passed to `useMutation`'s execute function is used when provided. Previously this option was ignored.
|
1493 |
|
1494 | - [#9124](https://github.com/apollographql/apollo-client/pull/9124) [`975b923c0`](https://github.com/apollographql/apollo-client/commit/975b923c0c0e7ddc8553917a91981e9f41713bc1) Thanks [@andrebrantom](https://github.com/andrebrantom)! - Make `ApolloClient.writeQuery` and `ApolloClient.writeFragment` behave more like `cache.writeQuery` and `cache.writeFragment` by returning the reference returned by the cache.
|
1495 |
|
1496 | ## 3.7.9
|
1497 |
|
1498 | ### Patch Changes
|
1499 |
|
1500 | - [#10560](https://github.com/apollographql/apollo-client/pull/10560) [`a561ecf43`](https://github.com/apollographql/apollo-client/commit/a561ecf4306c56770ba0713f0136174275887f1a) Thanks [@benjamn](https://github.com/benjamn)! - Keep `__typename` fragment when it does not contain `@client` directive and strip out inline fragments which use a `@client` directive. Thanks @Gazler and @mtsmfm!
|
1501 |
|
1502 | - [#10560](https://github.com/apollographql/apollo-client/pull/10560) [`251a12806`](https://github.com/apollographql/apollo-client/commit/251a12806d1fa38bc8723540fb2d696c39db1097) Thanks [@benjamn](https://github.com/benjamn)! - Refactor `removeDirectivesFromDocument` to fix AST ordering sensitivities and avoid 1/3 AST traversals, potentially improving performance for large queries
|
1503 |
|
1504 | ## 3.7.8
|
1505 |
|
1506 | ### Patch Changes
|
1507 |
|
1508 | - [#7555](https://github.com/apollographql/apollo-client/pull/7555) [`45562d6fa`](https://github.com/apollographql/apollo-client/commit/45562d6fa20eab658bd86d79d092862ace4e1225) Thanks [@TheCeloReis](https://github.com/TheCeloReis)! - Adds `TVariables` generic to `GraphQLRequest` and `MockedResponse` interfaces.
|
1509 |
|
1510 | - [#10526](https://github.com/apollographql/apollo-client/pull/10526) [`1d13de4f1`](https://github.com/apollographql/apollo-client/commit/1d13de4f190150e96d61a9e987274ee6c249dbef) Thanks [@benjamn](https://github.com/benjamn)! - Tolerate undefined `concast.sources` if `complete` called earlier than `concast.start`
|
1511 |
|
1512 | - [#10497](https://github.com/apollographql/apollo-client/pull/10497) [`8a883d8a1`](https://github.com/apollographql/apollo-client/commit/8a883d8a1c8899f94a3e2ae09cb2069bde2b2150) Thanks [@nevir](https://github.com/nevir)! - Update `SingleExecutionResult` and `IncrementalPayload`'s `data` types such that they no longer include `undefined`, which was not a valid runtime value, to fix errors when TypeScript's `exactOptionalPropertyTypes` is enabled.
|
1513 |
|
1514 | ## 3.7.7
|
1515 |
|
1516 | ### Patch Changes
|
1517 |
|
1518 | - [#10502](https://github.com/apollographql/apollo-client/pull/10502) [`315faf9ca`](https://github.com/apollographql/apollo-client/commit/315faf9ca5b326852919ab7fc2082d6ba92bcb59) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Log a warning to the console when a mock passed to `MockedProvider` or `MockLink` cannot be matched to a query during a test. This makes it easier to debug user errors in the mock setup, such as typos, especially if the query under test is using an `errorPolicy` set to `ignore`, which makes it difficult to know that a match did not occur.
|
1519 |
|
1520 | - [#10499](https://github.com/apollographql/apollo-client/pull/10499) [`9e54f5dfa`](https://github.com/apollographql/apollo-client/commit/9e54f5dfa05fd363e534c432ba8c569bb96a6e35) Thanks [@phryneas](https://github.com/phryneas)! - Allow the execution function returned by `useLazyQuery` to change the query.
|
1521 |
|
1522 | - [#10362](https://github.com/apollographql/apollo-client/pull/10362) [`14a56b105`](https://github.com/apollographql/apollo-client/commit/14a56b105fefcbb2ce5daa9fd6924e5decafcc16) Thanks [@mccraveiro](https://github.com/mccraveiro)! - Fix error when server returns an error and we are also querying for a local field
|
1523 |
|
1524 | ## 3.7.6
|
1525 |
|
1526 | ### Patch Changes
|
1527 |
|
1528 | - [#10470](https://github.com/apollographql/apollo-client/pull/10470) [`47435e879`](https://github.com/apollographql/apollo-client/commit/47435e879ebc867d9fc3de5b6fd5785204b4dbd4) Thanks [@alessbell](https://github.com/alessbell)! - Bumps TypeScript to `4.9.4` (previously `4.7.4`) and updates types to account for changes in TypeScript 4.8 by [propagating contstraints on generic types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#unconstrained-generics-no-longer-assignable-to). Technically this makes some types stricter as attempting to pass `null|undefined` into certain functions is now disallowed by TypeScript, but these were never expected runtime values in the first place.
|
1529 | This should only affect you if you are wrapping functions provided by Apollo Client with your own abstractions that pass in their generics as type arguments, in which case you might get an error like `error TS2344: Type 'YourGenericType' does not satisfy the constraint 'OperationVariables'`. In that case, make sure that `YourGenericType` is restricted to a type that only accepts objects via `extends`, like `Record<string, any>` or `@apollo/client`'s `OperationVariables`:
|
1530 |
|
1531 | ```diff
|
1532 | import {
|
1533 | QueryHookOptions,
|
1534 | QueryResult,
|
1535 | useQuery,
|
1536 | + OperationVariables,
|
1537 | } from '@apollo/client';
|
1538 | - export function useWrappedQuery<T, TVariables>(
|
1539 | + export function useWrappedQuery<T, TVariables extends OperationVariables>(
|
1540 | query: DocumentNode,
|
1541 | queryOptions: QueryHookOptions<T, TVariables>
|
1542 | ): QueryResult<T, TVariables> {
|
1543 | const [execute, result] = useQuery<T, TVariables>(query);
|
1544 | }
|
1545 | ```
|
1546 |
|
1547 | - [#10408](https://github.com/apollographql/apollo-client/pull/10408) [`55ffafc58`](https://github.com/apollographql/apollo-client/commit/55ffafc585e9eb66314755b4f40804b8b8affb13) Thanks [@zlrlo](https://github.com/zlrlo)! - fix: modify BatchHttpLink to have a separate timer for each different batch key
|
1548 |
|
1549 | - [#9573](https://github.com/apollographql/apollo-client/pull/9573) [`4a4f48dda`](https://github.com/apollographql/apollo-client/commit/4a4f48dda8dd290ef110aed9e4e73d0c1c977c31) Thanks [@vladar](https://github.com/vladar)! - Improve performance of local resolvers by only executing selection sets that contain an `@client` directive. Previously, local resolvers were executed even when the field did not contain `@client`. While the result was properly discarded, the unncessary work could negatively affect query performance, sometimes signficantly.
|
1550 |
|
1551 | ## 3.7.5
|
1552 |
|
1553 | ### Patch Changes
|
1554 |
|
1555 | - [#10458](https://github.com/apollographql/apollo-client/pull/10458) [`b5ccef229`](https://github.com/apollographql/apollo-client/commit/b5ccef229046d230e82a68a4834ac09ae1ef2009) Thanks [@lennyburdette](https://github.com/lennyburdette)! - Passes `getServerSnapshot` to `useSyncExternalStore` so that it doesn't trigger a `Missing getServerSnapshot` error when using `useFragment_experimental` on the server.
|
1556 |
|
1557 | - [#10471](https://github.com/apollographql/apollo-client/pull/10471) [`895ddcb54`](https://github.com/apollographql/apollo-client/commit/895ddcb546b5692cd53caae1b604412728641374) Thanks [@alessbell](https://github.com/alessbell)! - More robust type definition for `headers` property passed to `createHttpLink`
|
1558 |
|
1559 | - [#10321](https://github.com/apollographql/apollo-client/pull/10321) [`bbaa3ef2d`](https://github.com/apollographql/apollo-client/commit/bbaa3ef2d95a03e2453ef86a25096c314fbd8998) Thanks [@alessbell](https://github.com/alessbell)! - Refetch should not return partial data with `errorPolicy: none` and `notifyOnNetworkStatusChange: true`.
|
1560 |
|
1561 | - [#10402](https://github.com/apollographql/apollo-client/pull/10402) [`0b07aa955`](https://github.com/apollographql/apollo-client/commit/0b07aa955bab2e929f21590b565507a66f930539) Thanks [@Hugodby](https://github.com/Hugodby)! - Improve context types
|
1562 |
|
1563 | - [#10469](https://github.com/apollographql/apollo-client/pull/10469) [`328c58f90`](https://github.com/apollographql/apollo-client/commit/328c58f90d3fd985a58a68d8ba07f7c03f9808f6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add generic type defaults when using `useFragment` to allow passing `TData` directly to the function without needing to specify `TVars`.
|
1564 |
|
1565 | ## 3.7.4
|
1566 |
|
1567 | ### Patch Changes
|
1568 |
|
1569 | - [#10427](https://github.com/apollographql/apollo-client/pull/10427) [`28d909cff`](https://github.com/apollographql/apollo-client/commit/28d909cff086f8352e2ea75421a1cac590917573) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure in-flight promises executed by `useLazyQuery` are rejected when `useLazyQuery` unmounts.
|
1570 |
|
1571 | - [#10383](https://github.com/apollographql/apollo-client/pull/10383) [`5c5ca9b01`](https://github.com/apollographql/apollo-client/commit/5c5ca9b01a2b9905f94de85e5b80ffc29522e2e3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure the `onError` callback is called when the `errorPolicy` is set to "all" and partial data is returned.
|
1572 |
|
1573 | - [#10425](https://github.com/apollographql/apollo-client/pull/10425) [`86e35a6d2`](https://github.com/apollographql/apollo-client/commit/86e35a6d25e9838f39a9de652e52a358b9c08488) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prefer the `onError` and `onCompleted` callback functions passed to the execute function returned from `useMutation` instead of calling both callback handlers.
|
1574 |
|
1575 | ## 3.7.3
|
1576 |
|
1577 | ### Patch Changes
|
1578 |
|
1579 | - [#10334](https://github.com/apollographql/apollo-client/pull/10334) [`7d923939d`](https://github.com/apollographql/apollo-client/commit/7d923939dd7e6db7d69f04f598c666104b076e78) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Better handle deferred queries that have cached or partial cached data for them
|
1580 |
|
1581 | - [#10368](https://github.com/apollographql/apollo-client/pull/10368) [`46b58e976`](https://github.com/apollographql/apollo-client/commit/46b58e9762abbffaee5c9abda8e309bea6d7a785) Thanks [@alessbell](https://github.com/alessbell)! - Fix: unblocks support for defer in mutations
|
1582 |
|
1583 | If the `@defer` directive is present in the document passed to `mutate`, the Promise will resolve with the final merged data after the last multipart chunk has arrived in the response.
|
1584 |
|
1585 | ## 3.7.2
|
1586 |
|
1587 | ### Patch Changes
|
1588 |
|
1589 | - Only show dev tools suggestion in the console when `connectToDevTools` is `true`. <br/>
|
1590 | [@chris110408](https://github.com/chris110408) in [#10258](https://github.com/apollographql/apollo-client/pull/10258)
|
1591 |
|
1592 | - Pass `TCache` generic to `MutationHookOptions` for better type support in `useMutation`. <br />
|
1593 | [@igrlk](https://github.com/igrlk) in [#10223](https://github.com/apollographql/apollo-client/pull/10223)
|
1594 |
|
1595 | - Add `name` property to `ApolloError` to ensure better type safety and help error reporting tools better identify the error. <br />
|
1596 | [@aaronadamsCA](https://github.com/aaronadamsCA) in [#9323](https://github.com/apollographql/apollo-client/pull/9323)
|
1597 |
|
1598 | - Export a `ModifierDetails` type for the `details` parameter of a `Modifier` function. <br />
|
1599 | [@KeithGillette](https://github.com/KeithGillette) in [#7133](https://github.com/apollographql/apollo-client/pull/7133)
|
1600 |
|
1601 | - Revert use of `cloneDeep` to clone options when fetching queries. <br />
|
1602 | [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10215](https://github.com/apollographql/apollo-client/pull/10215)
|
1603 |
|
1604 | ## 3.7.1
|
1605 |
|
1606 | ### Patch Changes
|
1607 |
|
1608 | - Fix issue where `loading` remains `true` after `observer.refetch` is called repeatedly with different variables when the same data are returned. <br/>
|
1609 | [@alessbell](https://github.com/alessbell) in [#10143](https://github.com/apollographql/apollo-client/pull/10143)
|
1610 |
|
1611 | - Fix race condition where `useFragment_experimental` could receive cache updates before initially calling `cache.watch` in `useEffect`. <br/>
|
1612 | [@benjamn](https://github.com/benjamn) in [#10212](https://github.com/apollographql/apollo-client/pull/10212)
|
1613 |
|
1614 | ## 3.7.0
|
1615 |
|
1616 | ### Minor Changes
|
1617 |
|
1618 | - Implement preview support for the [`@defer` directive](https://github.com/graphql/graphql-spec/pull/742). <br/>
|
1619 | [@alessbell](https://github.com/alessbell) and [@benjamn](https://github.com/benjamn) in [#10018](https://github.com/apollographql/apollo-client/pull/10018)
|
1620 |
|
1621 | - Implement `useFragment_experimental` hook, which represents a lightweight live binding into the `ApolloCache`, and never triggers network requests of its own. <br/>
|
1622 | [@benjamn](https://github.com/benjamn) in [#8782](https://github.com/apollographql/apollo-client/pull/8782)
|
1623 |
|
1624 | - Allow registering named fragments with `InMemoryCache` to support using `...NamedFragment` in queries without redeclaring `NamedFragment` repeatedly in every query that uses it. <br/>
|
1625 | [@benjamn](https://github.com/benjamn) in [#9764](https://github.com/apollographql/apollo-client/pull/9764)
|
1626 |
|
1627 | - Support `onError` callback for `useSubscription` hook. <br/>
|
1628 | [@jeroenvisser101](https://github.com/jeroenvisser101) in [#9495](https://github.com/apollographql/apollo-client/pull/9495)
|
1629 |
|
1630 | - Implement `preserveHeaderCase` option for `http` context object, enabling preserved header capitalization for non-http-spec-compliant servers. <br/>
|
1631 | [@mrdoombringer](https://github.com/mrdoombringer) in [#9891](https://github.com/apollographql/apollo-client/pull/9891)
|
1632 |
|
1633 | ### Patch Changes
|
1634 |
|
1635 | - Delay calling `onCompleted` and `onError` callbacks passed to `useQuery` using `Promise.resolve().then(() => ...)` to fix issue [#9794](https://github.com/apollographql/apollo-client/pull/9794). <br/>
|
1636 | [@dylanwulf](https://github.com/dylanwulf) in [#9823](https://github.com/apollographql/apollo-client/pull/9823)
|
1637 |
|
1638 | - Replace `concast.cleanup` method with simpler `concast.beforeNext` API, which promises to call the given callback function just before the next result/error is delivered. In addition, `concast.removeObserver` no longer takes a `quietly?: boolean` parameter, since that parameter was partly responsible for cleanup callbacks sometimes not getting called. <br/>
|
1639 | [@benjamn](https://github.com/benjamn) in [#9718](https://github.com/apollographql/apollo-client/pull/9718)
|
1640 |
|
1641 | - Allow preserving header name capitalization when creating an `HttpLink` with `createHttpLink({ uri, preserveHeaderCase: true })`. Otherwise, header names are converted to lowercase to prevent case-sensitivity bugs. <br/>
|
1642 | [@MrDoomBringer](https://github.com/MrDoomBringer) in [#9891](https://github.com/apollographql/apollo-client/pull/9891)
|
1643 |
|
1644 | - Make queries with a `pollInterval` respect the `no-cache` fetch policy, instead of writing polled results into the cache. <br/>
|
1645 | [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10020](https://github.com/apollographql/apollo-client/pull/10020)
|
1646 |
|
1647 | - Deprecate the `onSubscriptionData` callback in favor of a new `onData` callback for the `useSubscription` hook. Deprecate the `onSubscriptionComplete` callback in favor of a new `onComplete` callback for the `useSubscription` hook.<br/>
|
1648 | [@jerelmiller](https://github.com/jerelmiller) in [#10134](https://github.com/apollographql/apollo-client/pull/10134)
|
1649 |
|
1650 | ### Potentially disruptive
|
1651 |
|
1652 | - The optional `subscribeAndCount` testing utility exported from `@apollo/client/testing/core` now takes a single generic `TResult` type parameter, instead of `TData`. This type will typically be inferred from the `observable` argument type, but if you have any explicit calls to `subscribeAndCount<TData>(...)` in your own codebase, you may need to adjust those calls accordingly. <br/>
|
1653 | [@benjamn](https://github.com/benjamn) in [#9718](https://github.com/apollographql/apollo-client/pull/9718)
|
1654 |
|
1655 | ## Apollo Client 3.6.10 (2022-09-29)
|
1656 |
|
1657 | ### Improvements
|
1658 |
|
1659 | - The client options (`variables`, `context`, etc.) used for `mutation` calls are now available as the second argument to the `onCompleted` and `onError` callback functions. <br/>
|
1660 | [@MrDoomBringer](https://github.com/MrDoomBringer) in [#10052](https://github.com/apollographql/apollo-client/pull/10052)
|
1661 |
|
1662 | ## Apollo Client 3.6.9 (2022-06-21)
|
1663 |
|
1664 | ### Bug Fixes
|
1665 |
|
1666 | - Leave `fetchPolicy` unchanged when `skip: true` (or in standby) and `nextFetchPolicy` is available, even if `variables` change. <br/>
|
1667 | [@benjamn](https://github.com/benjamn) in [#9823](https://github.com/apollographql/apollo-client/pull/9823)
|
1668 |
|
1669 | ## Apollo Client 3.6.8 (2022-06-10)
|
1670 |
|
1671 | ### Bug Fixes
|
1672 |
|
1673 | - Fix incorrect `variables` passed in `FieldFunctionOptions` for nested `readField` calls in `read` and `merge` functions. <br/>
|
1674 | [@stardustxx](https://github.com/stardustxx) in [#9808](https://github.com/apollographql/apollo-client/pull/9808)
|
1675 |
|
1676 | - Improve repository build scripts to work better on Windows. <br/>
|
1677 | [@dylanwulf](https://github.com/dylanwulf) in [#9805](https://github.com/apollographql/apollo-client/pull/9805)
|
1678 |
|
1679 | - Ensure `useQuery(query, { skip: true }).called === false` rather than always returning `called` as `true`. <br/>
|
1680 | [@KucharskiPiotr](https://github.com/KucharskiPiotr) in [#9798](https://github.com/apollographql/apollo-client/pull/9798)
|
1681 |
|
1682 | - Allow abandoned `reobserve` requests to unsubscribe from their underlying `Observable`. <br/>
|
1683 | [@javier-garcia-meteologica](https://github.com/javier-garcia-meteologica) in [#9791](https://github.com/apollographql/apollo-client/pull/9791)
|
1684 |
|
1685 | ## Apollo Client 3.6.7 (2022-06-10)
|
1686 |
|
1687 | ### Bug Fixes
|
1688 |
|
1689 | - Fix regression (introduced in v3.6.0) that caused `BatchHttpLink` to discard pending batched queries on early completion of the underlying `Observable`. <br/>
|
1690 | [@benjamn](https://github.com/benjamn) in [#9793](https://github.com/apollographql/apollo-client/pull/9793)
|
1691 |
|
1692 | ## Apollo Client 3.6.6 (2022-05-26)
|
1693 |
|
1694 | ### Bug Fixes
|
1695 |
|
1696 | - Allow `useLazyQuery(query, { defaultOptions })` to benefit from `defaultOptions.variables` and `client.defaultOptions.watchQuery.variables` merging. <br/>
|
1697 | [@benjamn](https://github.com/benjamn) in [#9762](https://github.com/apollographql/apollo-client/pull/9762)
|
1698 |
|
1699 | ## Apollo Client 3.6.5 (2022-05-23)
|
1700 |
|
1701 | ### Bug Fixes
|
1702 |
|
1703 | - Restore pre-v3.6 `variables` replacement behavior of `ObservableQuery#reobserve` method, fixing a regression that prevented removal of variables. <br/>
|
1704 | [@benjamn](https://github.com/benjamn) in [#9741](https://github.com/apollographql/apollo-client/pull/9741)
|
1705 |
|
1706 | - Preserve `previousData` even when different query or client provided to `useQuery`, instead of resetting `previousData` to undefined in those cases, matching behavior prior to v3.6.0. <br/>
|
1707 | [@benjamn](https://github.com/benjamn) in [#9734](https://github.com/apollographql/apollo-client/pull/9734)
|
1708 |
|
1709 | - Fix bug where `onCompleted()` and `onError()` are stale for `useMutation()`. <br/>
|
1710 | [@charle692](https://github.com/charle692) in [#9740](https://github.com/apollographql/apollo-client/pull/9740)
|
1711 |
|
1712 | - Limit scope of `DeepMerger` object reuse, and avoid using `Object.isFrozen`, which can introduce differences between development and production if objects that were frozen using `Object.freeze` in development are left unfrozen in production. <br/>
|
1713 | [@benjamn](https://github.com/benjamn) in [#9742](https://github.com/apollographql/apollo-client/pull/9742)
|
1714 |
|
1715 | - Properly merge `variables` from original `useLazyQuery(query, { variables })` with `variables` passed to execution function. <br/>
|
1716 | [@benjamn](https://github.com/benjamn) in [#9758](https://github.com/apollographql/apollo-client/pull/9758)
|
1717 |
|
1718 | ## Apollo Client 3.6.4 (2022-05-16)
|
1719 |
|
1720 | ### Bug Fixes
|
1721 |
|
1722 | - Guarantee `Concast` cleanup without `Observable cancelled prematurely` rejection, potentially solving long-standing issues involving that error. <br/>
|
1723 | [@benjamn](https://github.com/benjamn) in [#9701](https://github.com/apollographql/apollo-client/pull/9701)
|
1724 |
|
1725 | - Ensure `useSubscription` subscriptions are properly restarted after unmounting/remounting by React 18 in `<StrictMode>`. <br/>
|
1726 | [@kazekyo](https://github.com/kazekyo) in [#9707](https://github.com/apollographql/apollo-client/pull/9707)
|
1727 |
|
1728 | ### Improvements
|
1729 |
|
1730 | - Internalize `useSyncExternalStore` shim, for more control than `use-sync-external-store` provides, fixing some React Native issues. <br/>
|
1731 | [@benjamn](https://github.com/benjamn) in [#9675](https://github.com/apollographql/apollo-client/pull/9675) and [#9709](https://github.com/apollographql/apollo-client/pull/9709)
|
1732 |
|
1733 | - Provide `@apollo/client/**/*.cjs.native.js` versions of every `@apollo/client/**/*.cjs` bundle (including dependencies `ts-invariant` and `zen-observable-ts`) to help React Native's Metro bundler automatically resolve CommonJS entry point modules. **These changes should render unnecessary [the advice we gave in the v3.5.4 section below about `metro.config.js`](#apollo-client-354-2021-11-19).** <br/>
|
1734 | [@benjamn](https://github.com/benjamn) in [#9716](https://github.com/apollographql/apollo-client/pull/9716)
|
1735 |
|
1736 | - Handle falsy `incoming` data more gracefully in `offetLimitPagination().merge` function. <br/>
|
1737 | [@shobhitsharma](https://github.com/shobhitsharma) in [#9705](https://github.com/apollographql/apollo-client/pull/9705)
|
1738 |
|
1739 | ## Apollo Client 3.6.3 (2022-05-05, only tagged `next` on npm)
|
1740 |
|
1741 | ### Bug Fixes
|
1742 |
|
1743 | - Simplify `useQuery(query, { defaultOptions })` default options processing in order to fix bug where `skip: true` queries failed to execute upon switching to `skip: false`. <br/>
|
1744 | [@benjamn](https://github.com/benjamn) in [#9665](https://github.com/apollographql/apollo-client/pull/9665)
|
1745 |
|
1746 | - Add tests of skipping/unskipping and `useLazyQuery` with `defaultOptions`, and fix a bug causing duplicate requests. <br/>
|
1747 | [@benjamn](https://github.com/benjamn) in [#9666](https://github.com/apollographql/apollo-client/pull/9666)
|
1748 |
|
1749 | - Update `ts-invariant` to version 0.10.2 to fix source map warnings. <br/>
|
1750 | [@benjamn](https://github.com/benjamn) in [#9672](https://github.com/apollographql/apollo-client/pull/9672)
|
1751 |
|
1752 | - Test that `useQuery` queries with `skip: true` do not stall server-side rendering. <br/>
|
1753 | [@nathanmarks](https://github.com/nathanmarks) and [@benjamn](https://github.com/benjamn) in [#9677](https://github.com/apollographql/apollo-client/pull/9677)
|
1754 |
|
1755 | - Prevent `useLazyQuery` from making duplicate requests when its execution function is first called, and stop rejecting the `Promise` it returns when `result.error` is defined. <br/>
|
1756 | [@benjamn](https://github.com/benjamn) in [#9684](https://github.com/apollographql/apollo-client/pull/9684)
|
1757 |
|
1758 | - Fix issue with `useQuery` returning `loading: true` state during server-side rendering with `skip: true`. <br/>
|
1759 | [@nathanmarks](https://github.com/nathanmarks) in [#9679](https://github.com/apollographql/apollo-client/pull/9679)
|
1760 |
|
1761 | ## Apollo Client 3.6.2 (2022-05-02)
|
1762 |
|
1763 | ### Bug Fixes
|
1764 |
|
1765 | - Pass `getServerSnapshot` function to `useSyncExternalStore` in addition to `getSnapshot`, though the two functions behave identically. This change should fix/unbreak React 18 server rendering. <br/>
|
1766 | [@hungphongbk](https://github.com/hungphongbk) in [#9652](https://github.com/apollographql/apollo-client/pull/9652)
|
1767 |
|
1768 | ### Improvements
|
1769 |
|
1770 | - Consider `networkError.result.errors` in addition to `result.errors` in `PersistedQueryLink`. <br/>
|
1771 | [@redaid113](https://github.com/redaid113) and [@benjamn](https://github.com/benjamn) in [#9410](https://github.com/apollographql/apollo-client/pull/9410)
|
1772 |
|
1773 | ## Apollo Client 3.6.1 (2022-04-28)
|
1774 |
|
1775 | ### Bug Fixes
|
1776 |
|
1777 | - Remove recently-added, internal `fetchBlockingPromise` option from the `WatchQueryOptions` interface, due to regressions. <br/>
|
1778 | [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504)
|
1779 |
|
1780 | ## Apollo Client 3.6.0 (2022-04-26)
|
1781 |
|
1782 | ### Potentially disruptive changes
|
1783 |
|
1784 | - Calling `fetchMore` for queries using the `cache-and-network` or `network-only` fetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using the `cache-first` fetch policy. <br/>
|
1785 | [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504)
|
1786 |
|
1787 | - Reimplement `useQuery` and `useLazyQuery` to use the [proposed `useSyncExternalStore` API](https://github.com/reactwg/react-18/discussions/86) from React 18. <br/>
|
1788 | [@brainkim](https://github.com/brainkim) and [@benjamn](https://github.com/benjamn) in [#8785](https://github.com/apollographql/apollo-client/pull/8785) and [#9596](https://github.com/apollographql/apollo-client/pull/9596)
|
1789 |
|
1790 | - Fixed bug where the `useLazyQuery` execution function would always use the `refetch` method of `ObservableQuery`, instead of properly reapplying the current `fetchPolicy` using the `reobserve` method. <br/>
|
1791 | [@benjamn](https://github.com/benjamn) in [#9564](https://github.com/apollographql/apollo-client/pull/9564)
|
1792 |
|
1793 | > Since this `reobserve` method is useful and used internally, we have now exposed it as `use[Lazy]Query(...).reobserve` (which optionally takes a `Partial<WatchQueryOptions>` of new options), to supplement the existing `refetch` method. Note that `reobserve` permanently updates the `variables` and other options of the `ObservableQuery`, unlike `refetch({ ...variables })`, which does not save those `variables`.
|
1794 |
|
1795 | - The internal use of `options.fetchBlockingPromise` by `useQuery` and `useLazyQuery` may slightly delay the delivery of network results, compared to previous versions of Apollo Client. Since network results are already delivered asynchronously, these timing differences should not be disruptive in most cases. Nevertheless, please open an issue if the timing differences are a problem for you (and you have no easy workaround). <br/>
|
1796 | [@benjamn](https://github.com/benjamn) in [#9599](https://github.com/apollographql/apollo-client/pull/9599)
|
1797 |
|
1798 | ### React 18
|
1799 |
|
1800 | In both its `peerDependencies` and its internal implementation, Apollo Client v3.6 should no longer prevent you from updating to React 18 in your applications.
|
1801 |
|
1802 | Internally, we have refactored `useQuery` and `useLazyQuery` to be implemented in terms of React's new (shimmable) `useSyncExternalStore` hook, demonstrating Apollo Client can serve as an external store with a referentially stable, synchronous API, as needed by React.
|
1803 |
|
1804 | As part of this refactoring, we also improved the behavior of `useQuery` and `useLazyQuery` when used in `<React.StrictMode>`, which [double-renders components in development](https://github.com/reactwg/react-18/discussions/96). While this double-rendering always results in calling `useQuery` twice, forcing Apollo Client to create and then discard an unnecessary `ObservableQuery` object, we now have multiple defenses in place against executing any network queries for the unused `ObservableQuery` objects.
|
1805 |
|
1806 | In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling our server-side rendering utilities (`getDataFromTree` et al.), and introducing suspenseful versions of our hooks, to take full advantage of the new patterns React 18+ enables for data management libraries like Apollo Client.
|
1807 |
|
1808 | ### Improvements
|
1809 |
|
1810 | - Allow `BatchLink` to cancel queued and in-flight operations. <br/>
|
1811 | [@PowerKiKi](https://github.com/PowerKiKi) and [@benjamn](https://github.com/benjamn) in [#9248](https://github.com/apollographql/apollo-client/pull/9248)
|
1812 |
|
1813 | - Add `GraphQLWsLink` in `@apollo/client/link/subscriptions`. This link is similar to the existing `WebSocketLink` in `@apollo/client/link/ws`, but uses the newer [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) package and protocol instead of the older `subscriptions-transport-ws` implementation. This functionality was technically first released in `@apollo/client@3.5.10`, but semantically belongs in the 3.6.0 minor version.
|
1814 | [@glasser](https://github.com/glasser) in [#9369](https://github.com/apollographql/apollo-client/pull/9369)
|
1815 |
|
1816 | - Allow passing `defaultOptions` to `useQuery` to avoid clobbering/resetting existing options when `useQuery` is called repeatedly. <br/>
|
1817 | [@benjamn](https://github.com/benjamn) in [#9563](https://github.com/apollographql/apollo-client/pull/9563), superseding [#9223](https://github.com/apollographql/apollo-client/pull/9223)
|
1818 |
|
1819 | - Provide additional context to `nextFetchPolicy` functions to assist with `fetchPolicy` transitions. More details can be found in the [`nextFetchPolicy` documentation](https://www.apollographql.com/docs/react/data/queries/#nextfetchpolicy). <br/>
|
1820 | [@benjamn](https://github.com/benjamn) in [#9222](https://github.com/apollographql/apollo-client/pull/9222)
|
1821 |
|
1822 | - Remove nagging deprecation warning about passing an `options.updateQuery` function to `fetchMore`. <br/>
|
1823 | [@benjamn](https://github.com/benjamn) in [#9504](https://github.com/apollographql/apollo-client/pull/9504)
|
1824 |
|
1825 | - Let `addTypenameToDocument` take any `ASTNode` (including `DocumentNode`, as before). <br/>
|
1826 | [@benjamn](https://github.com/benjamn) in [#9595](https://github.com/apollographql/apollo-client/pull/9595)
|
1827 |
|
1828 | - Set `useMutation` internal `isMounted` variable to `true` again when component remounted. <br/>
|
1829 | [@devpeerapong](https://github.com/devpeerapong) in [#9561](https://github.com/apollographql/apollo-client/pull/9561)
|
1830 |
|
1831 | ## Apollo Client 3.5.10 (2022-02-24)
|
1832 |
|
1833 | ### Improvements
|
1834 |
|
1835 | - Add `GraphQLWsLink` in `@apollo/client/link/subscriptions`. This link is similar to the existing `WebSocketLink` in `@apollo/client/link/ws`, but uses the newer [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) package and protocol instead of the older `subscriptions-transport-ws` implementation. <br/>
|
1836 | [@glasser](https://github.com/glasser) in [#9369](https://github.com/apollographql/apollo-client/pull/9369)
|
1837 |
|
1838 | > Note from [@benjamn](https://github.com/benjamn): since `GraphQLWsLink` is new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual.
|
1839 |
|
1840 | ## Apollo Client 3.5.9 (2022-02-15)
|
1841 |
|
1842 | ### Improvements
|
1843 |
|
1844 | - Interpret `keyFields: [...]` and `keyArgs: [...]` configurations in `InMemoryCache` type/field policies as `ReadonlyArray`s, since they are never mutated internally. <br/>
|
1845 | [@julienfouilhe](https://github.com/julienfouilhe) in [#9339](https://github.com/apollographql/apollo-client/pull/9339)
|
1846 |
|
1847 | - Avoid declaring a global type for the `__DEV__` constant, to avoid conflict with other such global declarations. <br/>
|
1848 | [@benjamn](https://github.com/benjamn) in [#9386](https://github.com/apollographql/apollo-client/pull/9386)
|
1849 |
|
1850 | ### Bug Fixes
|
1851 |
|
1852 | - Fix `useSubscription` executing `skip`ped subscription when input changes. <br/>
|
1853 | [@levrik](https://github.com/levrik) in [#9299](https://github.com/apollographql/apollo-client/pull/9299)
|
1854 |
|
1855 | - Fix partial data appearing in `useQuery().data` when `notifyOnNetworkStatusChange: true`. <br/>
|
1856 | [@brainkim](https://github.com/brainkim) in [#9367](https://github.com/apollographql/apollo-client/pull/9367)
|
1857 |
|
1858 | - Prevent `Promise`s returned by `useLazyQuery` execute functions from causing unhandled `Promise` rejection errors if uncaught. <br/>
|
1859 | [@brainkim](https://github.com/brainkim) in [#9380](https://github.com/apollographql/apollo-client/pull/9380)
|
1860 |
|
1861 | ## Apollo Client 3.5.8 (2022-01-24)
|
1862 |
|
1863 | ### Bug Fixes
|
1864 |
|
1865 | - Fix the type of the `called` property returned by `useQuery()` and `useLazyQuery()`. <br/>
|
1866 | [@sztadii](https://github.com/sztadii) in [#9304](https://github.com/apollographql/apollo-client/pull/9304)
|
1867 |
|
1868 | ### Bug Fixes (by [@brainkim](https://github.com/brainkim) in [#9328](https://github.com/apollographql/apollo-client/pull/9328))
|
1869 |
|
1870 | - Fix `refetch()` not being called when `skip` is true.
|
1871 | - Fix the promise returned from the `useLazyQuery()` execution function having stale variables.
|
1872 | - Fix the promise returned from the `useLazyQuery()` execution function not rejecting when a query errors.
|
1873 |
|
1874 | ## Apollo Client 3.5.7 (2022-01-10)
|
1875 |
|
1876 | ### Bug Fixes
|
1877 |
|
1878 | - Fix regression that prevented calling `onError` or `onCompleted` in some cases when using `useQuery`. <br/>
|
1879 | [@mmahalwy](https://github.com/mmahalwy) in [#9226](https://github.com/apollographql/apollo-client/pull/9226)
|
1880 |
|
1881 | - Make `useQuery` respect `defaultOptions.watchQuery.fetchPolicy`. <br/>
|
1882 | [@yasharzolmajdi](https://github.com/yasharzolmajdi) in [#9210](https://github.com/apollographql/apollo-client/pull/9210)
|
1883 |
|
1884 | ## Apollo Client 3.5.6 (2021-12-07)
|
1885 |
|
1886 | ### Bug Fixes (by [@brainkim](https://github.com/brainkim) in [#9144](https://github.com/apollographql/apollo-client/pull/9144))
|
1887 |
|
1888 | - Restores old behavior where the callback passed to `useMutation()` is constant.
|
1889 | - Fix `useMutation()` callbacks having stale closures.
|
1890 | - Fix `useQuery()` variables being out of date.
|
1891 |
|
1892 | ## Apollo Client 3.5.5 (2021-11-23)
|
1893 |
|
1894 | ### Bug Fixes
|
1895 |
|
1896 | - Remove `printer: Printer` positional parameter from publicly-exported `selectHttpOptionsAndBody` function, whose addition in [#8699](https://github.com/apollographql/apollo-client/pull/8699) was a breaking change (starting in Apollo Client 3.5.0) for direct consumers of `selectHttpOptionsAndBody`. <br/>
|
1897 | [@benjamn](https://github.com/benjamn) in [#9103](https://github.com/apollographql/apollo-client/pull/9103)
|
1898 |
|
1899 | ## Apollo Client 3.5.4 (2021-11-19)
|
1900 |
|
1901 | ### Notices
|
1902 |
|
1903 | > ⚠️ The following advice about `metro.config.js` should no longer be necessary, as of Apollo Client v3.6.4.
|
1904 |
|
1905 | - [Relevant if you use Apollo Client with React Native] Since Apollo Client v3.5.0, CommonJS bundles provided by `@apollo/client` use a `.cjs` file extension rather than `.cjs.js`, so Node.js won't interpret them as ECMAScript modules. While this change should be an implementation detail, it may cause problems for the [Metro bundler](https://facebook.github.io/metro/) used by React Native, whose [`resolver.sourceExts`](https://facebook.github.io/metro/docs/configuration#sourceexts) configuration does not include the `cjs` extension by default.
|
1906 |
|
1907 | As a workaround until [this issue](https://github.com/facebook/metro/issues/535) is resolved, you can configure Metro to understand the `.cjs` file extension by creating a `metro.config.js` file in the root of your React Native project:
|
1908 |
|
1909 | ```js
|
1910 | // NOTE: No longer necessary in @apollo/client@3.6.4!
|
1911 | const { getDefaultConfig } = require("metro-config");
|
1912 | const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues();
|
1913 | exports.resolver = {
|
1914 | ...defaultResolver,
|
1915 | sourceExts: [...defaultResolver.sourceExts, "cjs"],
|
1916 | };
|
1917 | ```
|
1918 |
|
1919 | ### Improvements
|
1920 |
|
1921 | - Restore the ability to pass `onError()` and `onCompleted()` to the mutation execution function. <br/> [@brainkim](https://github.com/brainkim) in [#9076](https://github.com/apollographql/apollo-client/pull/9076)
|
1922 |
|
1923 | - Work around webpack 5 errors of the form
|
1924 | ```
|
1925 | The request 'ts-invariant/process' failed to resolve only because it was resolved as fully specified
|
1926 | ```
|
1927 | by ensuring `import ... from 'ts-invariant/process'` is internally written to `import ... from 'ts-invariant/process/index.js'`. <br/>
|
1928 | [@benjamn](https://github.com/benjamn) in [#9083](https://github.com/apollographql/apollo-client/pull/9083)
|
1929 |
|
1930 | ## Apollo Client 3.5.3 (2021-11-17)
|
1931 |
|
1932 | - Avoid rewriting non-relative imported module specifiers in `config/rewriteModuleIds.ts` script, thereby allowing bundlers to resolve those imports as they see fit. <br/>
|
1933 | [@benjamn](https://github.com/benjamn) in [#9073](https://github.com/apollographql/apollo-client/pull/9073)
|
1934 |
|
1935 | - Ensure only current file is matched when running VSCode debugger. <br/>
|
1936 | [@eps1lon](https://github.com/eps1lon) in [#9050](https://github.com/apollographql/apollo-client/pull/9050)
|
1937 |
|
1938 | ## Apollo Client 3.5.2 (2021-11-10)
|
1939 |
|
1940 | - Fix `useMutation` execute function returning non-identical execution functions when passing similar options. <br/>
|
1941 | [@brainkim](https://github.com/brainkim) in [#9037](https://github.com/apollographql/apollo-client/pull/9037)
|
1942 |
|
1943 | ## Apollo Client 3.5.1 (2021-11-09)
|
1944 |
|
1945 | - Remove npm from dependencies, and avoid referencing graphql-js enum value. <br/>
|
1946 | [@brainkim](https://github.com/brainkim) in [#9030](https://github.com/apollographql/apollo-client/pull/9030)
|
1947 |
|
1948 | ## Apollo Client 3.5.0 (2021-11-08)
|
1949 |
|
1950 | ### Improvements
|
1951 |
|
1952 | - Add `updateQuery` and `updateFragment` methods to `ApolloCache`, simplifying common `readQuery`/`writeQuery` cache update patterns. <br/>
|
1953 | [@wassim-k](https://github.com/wassim-k) in [#8382](https://github.com/apollographql/apollo-client/pull/8382)
|
1954 |
|
1955 | - Field directives and their arguments can now be included along with field argument names when using [field policy `keyArgs: [...]` notation](https://www.apollographql.com/docs/react/pagination/key-args/). For example, if you have a `Query.feed` field that takes an argument called `type` and uses a `@connection(key:...)` directive to keep `feed` data from different queries separate within the cache, you might configure both using the following `InMemoryCache` field policy:
|
1956 |
|
1957 | ```ts
|
1958 | new InMemoryCache({
|
1959 | typePolicies: {
|
1960 | Query: {
|
1961 | fields: {
|
1962 | feed: {
|
1963 | keyArgs: ["type", "@connection", ["key"]],
|
1964 | },
|
1965 | },
|
1966 | },
|
1967 | },
|
1968 | });
|
1969 | ```
|
1970 |
|
1971 | [@benjamn](https://github.com/benjamn) in [#8678](https://github.com/apollographql/apollo-client/pull/8678)
|
1972 |
|
1973 | - Report single `MissingFieldError` instead of a potentially very large `MissingFieldError[]` array for incomplete cache reads, improving performance and memory usage. <br/>
|
1974 | [@benjamn](https://github.com/benjamn) in [#8734](https://github.com/apollographql/apollo-client/pull/8734)
|
1975 |
|
1976 | - When writing results into `InMemoryCache`, each written object is now identified using `policies.identify` _after_ traversing the fields of the object (rather than before), simplifying identification and reducing duplicate work. If you have custom `keyFields` functions, they still receive the raw result object as their first parameter, but the `KeyFieldsContext` parameter now provides `context.storeObject` (the `StoreObject` just processed by `processSelectionSet`) and `context.readField` (a helper function for reading fields from `context.storeObject` and any `Reference`s it might contain, similar to `readField` for `read`, `merge`, and `cache.modify` functions). <br/>
|
1977 | [@benjamn](https://github.com/benjamn) in [#8996](https://github.com/apollographql/apollo-client/pull/8996)
|
1978 |
|
1979 | - Ensure `cache.identify` never throws when primary key fields are missing, and include the source object in the error message when `keyFields` processing fails. <br/>
|
1980 | [@benjamn](https://github.com/benjamn) in [#8679](https://github.com/apollographql/apollo-client/pull/8679)
|
1981 |
|
1982 | - The `HttpLink` constructor now accepts an optional `print` function that can be used to customize how GraphQL `DocumentNode` objects are transformed back into strings before they are sent over the network. <br/>
|
1983 | [@sarahgp](https://github.com/sarahgp) in [#8699](https://github.com/apollographql/apollo-client/pull/8699)
|
1984 |
|
1985 | - Make `@apollo/client/testing` a fully-fledged, independent entry point, instead of re-exporting `@apollo/client/utilities/testing` (which was never an entry point and no longer exists). <br/>
|
1986 | [@benjamn](https://github.com/benjamn) in [#8769](https://github.com/apollographql/apollo-client/pull/8769)
|
1987 |
|
1988 | - A new nested entry point called `@apollo/client/testing/core` has been created. Importing from this entry point instead of `@apollo/client/testing` excludes any React-related dependencies. <br/>
|
1989 | [@wassim-k](https://github.com/wassim-k) in [#8687](https://github.com/apollographql/apollo-client/pull/8687)
|
1990 |
|
1991 | - Make `cache.batch` return the result of calling the `options.update` function. <br/>
|
1992 | [@benjamn](https://github.com/benjamn) in [#8696](https://github.com/apollographql/apollo-client/pull/8696)
|
1993 |
|
1994 | - The `NetworkError` and `ErrorResponse` types have been changed to align more closely. <br/>
|
1995 | [@korywka](https://github.com/korywka) in [#8424](https://github.com/apollographql/apollo-client/pull/8424)
|
1996 |
|
1997 | - Include `graphql@16` in peer deps. <br/>
|
1998 | [@brainkim](https://github.com/brainkim) in [#8997](https://github.com/apollographql/apollo-client/pull/8997)
|
1999 |
|
2000 | - Update `zen-observable-ts` to eliminate transitive dependency on `@types/zen-observable`. <br/>
|
2001 | [@benjamn](https://github.com/benjamn) in [#8695](https://github.com/apollographql/apollo-client/pull/8695)
|
2002 |
|
2003 | ### React Refactoring
|
2004 |
|
2005 | #### Improvements (due to [@brainkim](https://github.com/brainkim) in [#8875](https://github.com/apollographql/apollo-client/pull/8875)):
|
2006 |
|
2007 | - The `useLazyQuery` function now returns a promise with the result.
|
2008 | - The `useMutation` result now exposes a method which can be reset.
|
2009 |
|
2010 | #### Bug Fixes (due to [@brainkim](https://github.com/brainkim) in [#8596](https://github.com/apollographql/apollo-client/pull/8596)):
|
2011 |
|
2012 | - The `useQuery` and `useLazyQuery` hooks will now have `ObservableQuery` methods defined consistently.
|
2013 | - Calling `useLazyQuery` methods like `startPolling` will start the query.
|
2014 | - Calling the `useLazyQuery` execution function will now behave more like `refetch`. `previousData` will be preserved.
|
2015 | - `standby` fetchPolicies will now act like `skip: true` more consistently.
|
2016 | - Calling `refetch` on a skipped query will have no effect (issue [#8270](https://github.com/apollographql/apollo-client/issues/8270)).
|
2017 | - Prevent `onError` and `onCompleted` functions from firing continuously, and improving their polling behavior.
|
2018 |
|
2019 | ## Apollo Client 3.4.17 (2021-11-08)
|
2020 |
|
2021 | ### Improvements
|
2022 |
|
2023 | - Allow `TOptions extends FieldFunctionOptions` to be passed as final (optional) type parameter of `FieldPolicy` type. <br/>
|
2024 | [@VictorGaiva](https://github.com/VictorGaiva) in [#9000](https://github.com/apollographql/apollo-client/pull/9000)
|
2025 |
|
2026 | ## Apollo Client 3.4.16
|
2027 |
|
2028 | ### Improvements
|
2029 |
|
2030 | - Prevent webpack from misresolving the `graphql` package as the local `@apollo/client/utilities/globals/graphql.js` module when `module.exports.resolve.preferRelative` is enabled in `webpack.config.js`.
|
2031 |
|
2032 | > Note: if you encounter strange module resolution errors like `export 'isType' (imported as 'isType') was not found in 'graphql' (possible exports: removeTemporaryGlobals)` please try removing `preferRelative: true` from your `webpack.config.js` file, or find a way to disable that resolution behavior for packages within `node_modules`.
|
2033 |
|
2034 | [@benjamn](https://github.com/benjamn) in [#8862](https://github.com/apollographql/apollo-client/pull/8862)
|
2035 |
|
2036 | - Avoid importing `isType` from the `graphql` package internally, to prevent bundlers from including as much as 3.4kB of unnecessary code. <br/>
|
2037 | [@benjamn](https://github.com/benjamn) in [#8891](https://github.com/apollographql/apollo-client/pull/8891)
|
2038 |
|
2039 | - Make `client.resetStore` and `client.clearStore` pass appropriate `discardWatches` option to `cache.reset`. <br/>
|
2040 | [@benjamn](https://github.com/benjamn) in [#8873](https://github.com/apollographql/apollo-client/pull/8873)
|
2041 |
|
2042 | ## Apollo Client 3.4.15
|
2043 |
|
2044 | ### Bug Fixes
|
2045 |
|
2046 | - Require calling `cache.reset({ discardWatches: true })` to make `cache.reset` discard `cache.watches`, restoring behavior broken in v3.4.14 by [#8826](https://github.com/apollographql/apollo-client/pull/8826). <br/>
|
2047 | [@benjamn](https://github.com/benjamn) in [#8852](https://github.com/apollographql/apollo-client/pull/8852)
|
2048 |
|
2049 | ## Apollo Client 3.4.14
|
2050 |
|
2051 | ### Bug Fixes
|
2052 |
|
2053 | - Disable `InMemoryCache` [result object canonization](https://github.com/apollographql/apollo-client/pull/7439) by default, to prevent unexpected memory growth and/or reuse of object references, with multiple ways to reenable it (per-cache, per-query, or a mixture of both). <br/>
|
2054 | [@benjamn](https://github.com/benjamn) in [#8822](https://github.com/apollographql/apollo-client/pull/8822)
|
2055 |
|
2056 | - Clear `InMemoryCache` `watches` set when `cache.reset()` called. <br/>
|
2057 | [@benjamn](https://github.com/benjamn) in [#8826](https://github.com/apollographql/apollo-client/pull/8826)
|
2058 |
|
2059 | - Stop excluding observerless queries from `refetchQueries: [...]` selection. <br/>
|
2060 | [@benjamn](https://github.com/benjamn) in [#8825](https://github.com/apollographql/apollo-client/pull/8825)
|
2061 |
|
2062 | - Prevent optimistic cache evictions from evicting non-optimistic data. <br/>
|
2063 | [@benjamn](https://github.com/benjamn) in [#8829](https://github.com/apollographql/apollo-client/pull/8829)
|
2064 |
|
2065 | - Ensure `cache.broadcastWatch` passes all relevant `WatchOptions` to `cache.diff` as `DiffOptions`. <br/>
|
2066 | [@benjamn](https://github.com/benjamn) in [#8832](https://github.com/apollographql/apollo-client/pull/8832)
|
2067 |
|
2068 | ## Apollo Client 3.4.13
|
2069 |
|
2070 | ### Bug Fixes
|
2071 |
|
2072 | - Fix `componentDidUpate` typo in `withSubscription` higher-order component. <br/>
|
2073 | [@YarBez](https://github.com/YarBez) in [#7506](https://github.com/apollographql/apollo-client/pull/7506)
|
2074 |
|
2075 | - Fix internal `canUseSymbol` import within `@apollo/client/utilities` to avoid breaking bundlers/builds. <br/>
|
2076 | [@benjamn](https://github.com/benjamn) in [#8817](https://github.com/apollographql/apollo-client/pull/8817)
|
2077 |
|
2078 | - Tolerate unfreezable objects like `Uint8Array` and `Buffer` in `maybeDeepFreeze`. <br/>
|
2079 | [@geekuillaume](https://github.com/geekuillaume) and [@benjamn](https://github.com/benjamn) in [#8813](https://github.com/apollographql/apollo-client/pull/8813)
|
2080 |
|
2081 | ## Apollo Client 3.4.12
|
2082 |
|
2083 | ### Bug Fixes
|
2084 |
|
2085 | - Improve handling of falsy `existing` and/or `incoming` parameters in `relayStylePagination` field policy helper function. <br/>
|
2086 | [@bubba](https://github.com/bubba) and [@benjamn](https://github.com/benjamn) in [#8733](https://github.com/apollographql/apollo-client/pull/8733)
|
2087 |
|
2088 | - Associate Apollo context with `React.createContext` (instead of using a local `WeakMap`) again, so multiple copies of `@apollo/client` (uncommon) can share the same context. <br/>
|
2089 | [@benjamn](https://github.com/benjamn) in [#8798](https://github.com/apollographql/apollo-client/pull/8798)
|
2090 |
|
2091 | ## Apollo Client 3.4.11
|
2092 |
|
2093 | ### Bug Fixes
|
2094 |
|
2095 | - Fix [Vite](https://vitejs.dev) tree-shaking by calling the `checkDEV()` function (at least once) in the module that exports it, `@apollo/client/utilities/globals/index.ts`. <br/>
|
2096 | [@benjamn](https://github.com/benjamn) in [#8767](https://github.com/apollographql/apollo-client/pull/8767)
|
2097 |
|
2098 | ### Improvements
|
2099 |
|
2100 | - Export `PersistedQueryLink` namespace from `@apollo/client/link/persisted-queries`. <br/>
|
2101 | [@vedrani](https://github.com/vedrani) in [#8761](https://github.com/apollographql/apollo-client/pull/8761)
|
2102 |
|
2103 | ### Documentation
|
2104 |
|
2105 | - Upgrade docs theme for new Algolia-powered search experience. <br/>
|
2106 | [@trevorblades](https://github.com/trevorblades) in [#8768](https://github.com/apollographql/apollo-client/pull/8768)
|
2107 |
|
2108 | ## Apollo Client 3.4.10
|
2109 |
|
2110 | ### Improvements
|
2111 |
|
2112 | - Warn when calling `refetch({ variables })` instead of `refetch(variables)`, except for queries that declare a variable named `$variables` (uncommon). <br/>
|
2113 | [@benjamn](https://github.com/benjamn) in [#8702](https://github.com/apollographql/apollo-client/pull/8702)
|
2114 |
|
2115 | ### Bug Fixes
|
2116 |
|
2117 | - Fix `ObservableQuery.getCurrentResult()` returning cached `data` with certain fetch policies. <br/>
|
2118 | [@brainkim](https://github.com/brainkim) in [#8718](https://github.com/apollographql/apollo-client/pull/8718)
|
2119 |
|
2120 | - Prevent `ssrMode`/`ssrForceFetchDelay` from causing queries to hang. <br/>
|
2121 | [@brainkim](https://github.com/brainkim) in [#8709](https://github.com/apollographql/apollo-client/pull/8709)
|
2122 |
|
2123 | - Import `@apollo/client/utilities/globals` internally wherever `__DEV__` is used, not just in `@apollo/client/**/index.js` entry points. <br/>
|
2124 | [@benjamn](https://github.com/benjamn) in [#8720](https://github.com/apollographql/apollo-client/pull/8720)
|
2125 |
|
2126 | ## Apollo Client 3.4.9
|
2127 |
|
2128 | ### Bug Fixes
|
2129 |
|
2130 | - Fix unhandled `Promise` rejection warnings/errors whose message is `Observable cancelled prematurely`. <br/>
|
2131 | [@benjamn](https://github.com/benjamn) in [#8676](https://github.com/apollographql/apollo-client/pull/8676)
|
2132 |
|
2133 | - Enforce that `__DEV__` is polyfilled by every `@apollo/client/*` entry point that uses it. This build step considers not only explicit `__DEV__` usage but also `__DEV__` references injected near `invariant(...)` and `new InvariantError(...)` expressions. <br/>
|
2134 | [@benjamn](https://github.com/benjamn) in [#8689](https://github.com/apollographql/apollo-client/pull/8689)
|
2135 |
|
2136 | ## Apollo Client 3.4.8
|
2137 |
|
2138 | ### Bug Fixes
|
2139 |
|
2140 | - Fix error thrown by nested `keyFields: ["a", ["b", "c"], "d"]` type policies when writing results into the cache where any of the key fields (`.a`, `.a.b`, `.a.c`, or `.d`) have been renamed by query field alias syntax. <br/>
|
2141 | [@benjamn](https://github.com/benjamn) in [#8643](https://github.com/apollographql/apollo-client/pull/8643)
|
2142 |
|
2143 | - Fix regression from PR [#8422](https://github.com/apollographql/apollo-client/pull/8422) (first released in `@apollo/client@3.4.0-rc.15`) that caused `result.data` to be set to undefined in some cases after `ObservableQuery#getCurrentResult` reads an incomplete result from the cache. <br/>
|
2144 | [@benjamn](https://github.com/benjamn) in [#8642](https://github.com/apollographql/apollo-client/pull/8642)
|
2145 |
|
2146 | ## Apollo Client 3.4.7
|
2147 |
|
2148 | ### Bug Fixes
|
2149 |
|
2150 | - Fix accidental reuse of recycled `MergeTree` objects in `StoreWriter` class used by `InMemoryCache`. <br/>
|
2151 | [@benjamn](https://github.com/benjamn) in [#8618](https://github.com/apollographql/apollo-client/pull/8618)
|
2152 |
|
2153 | ## Apollo Client 3.4.6
|
2154 |
|
2155 | ### Improvements
|
2156 |
|
2157 | - Reevaluate `window.fetch` each time `HttpLink` uses it, if not configured using `options.fetch`. This change enables a variety of strategies for instrumenting `window.fetch`, without requiring those strategies to run before `@apollo/client/link/http` is first imported. <br/>
|
2158 | [@benjamn](https://github.com/benjamn) in [#8603](https://github.com/apollographql/apollo-client/pull/8603)
|
2159 |
|
2160 | - Clarify mutation `fetchPolicy` options (`"network-only"` or `"no-cache"`) using [`MutationFetchPolicy`](https://github.com/apollographql/apollo-client/blob/fa52875341ab33f3e8192ded90af5e2c208e0f75/src/core/watchQueryOptions.ts#L33-L37) union type. <br/>
|
2161 | [@benjamn](https://github.com/benjamn) in [#8602](https://github.com/apollographql/apollo-client/pull/8602)
|
2162 |
|
2163 | ### Bug Fixes
|
2164 |
|
2165 | - Restore full `@apollo/client/apollo-client.cjs.js` CommonJS bundle for older bundlers.
|
2166 |
|
2167 | > Note that Node.js and CommonJS bundlers typically use the bundles specified by `"main"` fields in our generated `package.json` files, which are all independent and non-overlapping CommonJS modules. However, `apollo-client.cjs.js` is just one big bundle, so mixing imports of `apollo-client.cjs.js` with the other CommonJS bundles is discouraged, as it could trigger the [dual package hazard](https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages). In other words, please don't start using `apollo-client.cjs.js` if you're not already. <br/>
|
2168 |
|
2169 | [@benjamn](https://github.com/benjamn) in [#8592](https://github.com/apollographql/apollo-client/pull/8592)
|
2170 |
|
2171 | - Log `MissingFieldError`s in `ObservableQuery#getCurrentResult` using `invariant.debug`, rather than reporting them via `result.error`. <br/>
|
2172 | [@benjamn](https://github.com/benjamn) in [#8604](https://github.com/apollographql/apollo-client/pull/8604)
|
2173 |
|
2174 | ## Apollo Client 3.4.5
|
2175 |
|
2176 | ### Bug Fixes
|
2177 |
|
2178 | - Fix double registration bug for mutation `refetchQueries` specified using legacy one-time `refetchQueries: [{ query, variables }]` style. Though the bug is fixed, we recommend using `refetchQueries: [query]` instead (when possible) to refetch an existing query using its `DocumentNode`, rather than creating, executing, and then deleting a new query, as the legacy `{ query, variables }` style unfortunately does. <br/>
|
2179 | [@benjamn](https://github.com/benjamn) in [#8586](https://github.com/apollographql/apollo-client/pull/8586)
|
2180 |
|
2181 | - Fix `useQuery`/`useLazyQuery` stalling when clients or queries change. <br/>
|
2182 | [@brainkim](https://github.com/brainkim) in [#8589](https://github.com/apollographql/apollo-client/pull/8589)
|
2183 |
|
2184 | ## Apollo Client 3.4.4
|
2185 |
|
2186 | ### Bug Fixes
|
2187 |
|
2188 | - Revert accidental addition of `engines.npm` section to published version of `@apollo/client/package.json`. <br/>
|
2189 | [@benjamn](https://github.com/benjamn) in [#8578](https://github.com/apollographql/apollo-client/pull/8578)
|
2190 |
|
2191 | ## Apollo Client 3.4.3
|
2192 |
|
2193 | ### Bug Fixes
|
2194 |
|
2195 | - Fix `{ ssr: false }` causing queries to hang on the client. <br/>
|
2196 | [@brainkim](https://github.com/brainkim) in [#8574](https://github.com/apollographql/apollo-client/pull/8574)
|
2197 |
|
2198 | ## Apollo Client 3.4.2
|
2199 |
|
2200 | ### Bug Fixes
|
2201 |
|
2202 | - Use more default type parameters for mutation-related types in `react/types/types.ts`, to provide smoother backwards compatibility for code using those types explicitly. <br/>
|
2203 | [@benjamn](https://github.com/benjamn) in [#8573](https://github.com/apollographql/apollo-client/pull/8573)
|
2204 |
|
2205 | ## Apollo Client 3.4.1
|
2206 |
|
2207 | ### Bug Fixes
|
2208 |
|
2209 | - Initialize `stringifyCanon` lazily, when `canonicalStringify` is first called, fixing `Uncaught ReferenceError: __DEV__ is not defined` errors due to usage of `__DEV__` before declaration. <br/>
|
2210 | [@benjamn](https://github.com/benjamn) in [#8557](https://github.com/apollographql/apollo-client/pull/8557)
|
2211 |
|
2212 | ## Apollo Client 3.4.0
|
2213 |
|
2214 | ### New documentation
|
2215 |
|
2216 | - [**Refetching queries**](https://www.apollographql.com/docs/react/data/refetching/) with `client.refetchQueries`. <br/>
|
2217 | [@StephenBarlow](https://github.com/StephenBarlow) and [@benjamn](https://github.com/benjamn) in [#8265](https://github.com/apollographql/apollo-client/pull/8265)
|
2218 |
|
2219 | ### Improvements
|
2220 |
|
2221 | - `InMemoryCache` now _guarantees_ that any two result objects returned by the cache (from `readQuery`, `readFragment`, etc.) will be referentially equal (`===`) if they are deeply equal. Previously, `===` equality was often achievable for results for the same query, on a best-effort basis. Now, equivalent result objects will be automatically shared among the result trees of completely different queries. This guarantee is important for taking full advantage of optimistic updates that correctly guess the final data, and for "pure" UI components that can skip re-rendering when their input data are unchanged. <br/>
|
2222 | [@benjamn](https://github.com/benjamn) in [#7439](https://github.com/apollographql/apollo-client/pull/7439)
|
2223 |
|
2224 | - Mutations now accept an optional callback function called `onQueryUpdated`, which will be passed the `ObservableQuery` and `Cache.DiffResult` objects for any queries invalidated by cache writes performed by the mutation's final `update` function. Using `onQueryUpdated`, you can override the default `FetchPolicy` of the query, by (for example) calling `ObservableQuery` methods like `refetch` to force a network request. This automatic detection of invalidated queries provides an alternative to manually enumerating queries using the `refetchQueries` mutation option. Also, if you return a `Promise` from `onQueryUpdated`, the mutation will automatically await that `Promise`, rendering the `awaitRefetchQueries` option unnecessary. <br/>
|
2225 | [@benjamn](https://github.com/benjamn) in [#7827](https://github.com/apollographql/apollo-client/pull/7827)
|
2226 |
|
2227 | - Support `client.refetchQueries` as an imperative way to refetch queries, without having to pass `options.refetchQueries` to `client.mutate`. <br/>
|
2228 | [@dannycochran](https://github.com/dannycochran) in [#7431](https://github.com/apollographql/apollo-client/pull/7431)
|
2229 |
|
2230 | - Improve standalone `client.refetchQueries` method to support automatic detection of queries needing to be refetched. <br/>
|
2231 | [@benjamn](https://github.com/benjamn) in [#8000](https://github.com/apollographql/apollo-client/pull/8000)
|
2232 |
|
2233 | - Fix remaining barriers to loading [`@apollo/client/core`](https://cdn.jsdelivr.net/npm/@apollo/client@3.4.0/core/+esm) as native ECMAScript modules from a CDN like [esm.run](https://www.jsdelivr.com/esm). Importing `@apollo/client` from a CDN will become possible once we move all React-related dependencies into `@apollo/client/react` in Apollo Client 4. <br/>
|
2234 | [@benjamn](https://github.com/benjamn) in [#8266](https://github.com/apollographql/apollo-client/issues/8266)
|
2235 |
|
2236 | - `InMemoryCache` supports a new method called `batch`, which is similar to `performTransaction` but takes named options rather than positional parameters. One of these named options is an `onDirty(watch, diff)` callback, which can be used to determine which watched queries were invalidated by the `batch` operation. <br/>
|
2237 | [@benjamn](https://github.com/benjamn) in [#7819](https://github.com/apollographql/apollo-client/pull/7819)
|
2238 |
|
2239 | - Allow `merge: true` field policy to merge `Reference` objects with non-normalized objects, and vice-versa. <br/>
|
2240 | [@benjamn](https://github.com/benjamn) in [#7778](https://github.com/apollographql/apollo-client/pull/7778)
|
2241 |
|
2242 | - Allow identical subscriptions to be deduplicated by default, like queries. <br/>
|
2243 | [@jkossis](https://github.com/jkossis) in [#6910](https://github.com/apollographql/apollo-client/pull/6910)
|
2244 |
|
2245 | - Always use `POST` request when falling back to sending full query with `@apollo/client/link/persisted-queries`. <br/>
|
2246 | [@rieset](https://github.com/rieset) in [#7456](https://github.com/apollographql/apollo-client/pull/7456)
|
2247 |
|
2248 | - The `FetchMoreQueryOptions` type now takes two instead of three type parameters (`<TVariables, TData>`), thanks to using `Partial<TVariables>` instead of `K extends typeof TVariables` and `Pick<TVariables, K>`. <br/>
|
2249 | [@ArnaudBarre](https://github.com/ArnaudBarre) in [#7476](https://github.com/apollographql/apollo-client/pull/7476)
|
2250 |
|
2251 | - Pass `variables` and `context` to a mutation's `update` function. **Note:** The type of the `update` function is now named `MutationUpdaterFunction` rather than `MutationUpdaterFn`, since the older type was [broken beyond repair](https://github.com/apollographql/apollo-client/issues/8506#issuecomment-881706613). If you are using `MutationUpdaterFn` in your own code, please use `MutationUpdaterFunction` instead. <br/>
|
2252 | [@jcreighton](https://github.com/jcreighton) in [#7902](https://github.com/apollographql/apollo-client/pull/7902)
|
2253 |
|
2254 | - A `resultCacheMaxSize` option may be passed to the `InMemoryCache` constructor to limit the number of result objects that will be retained in memory (to speed up repeated reads), and calling `cache.reset()` now releases all such memory. <br/>
|
2255 | [@SofianHn](https://github.com/SofianHn) in [#8107](https://github.com/apollographql/apollo-client/pull/8107)
|
2256 |
|
2257 | - Fully remove result cache entries from LRU dependency system when the corresponding entities are removed from `InMemoryCache` by eviction, or by any other means. <br/>
|
2258 | [@sofianhn](https://github.com/sofianhn) and [@benjamn](https://github.com/benjamn) in [#8147](https://github.com/apollographql/apollo-client/pull/8147)
|
2259 |
|
2260 | - Expose missing field errors in results. <br/>
|
2261 | [@brainkim](github.com/brainkim) in [#8262](https://github.com/apollographql/apollo-client/pull/8262)
|
2262 |
|
2263 | - Add expected/received `variables` to `No more mocked responses...` error messages generated by `MockLink`. <br/>
|
2264 | [@markneub](github.com/markneub) in [#8340](https://github.com/apollographql/apollo-client/pull/8340)
|
2265 |
|
2266 | - The `InMemoryCache` version of the `cache.gc` method now supports additional options for removing non-essential (recomputable) result caching data. <br/>
|
2267 | [@benjamn](https://github.com/benjamn) in [#8421](https://github.com/apollographql/apollo-client/pull/8421)
|
2268 |
|
2269 | - Suppress noisy `Missing cache result fields...` warnings by default unless `setLogVerbosity("debug")` called. <br/>
|
2270 | [@benjamn](https://github.com/benjamn) in [#8489](https://github.com/apollographql/apollo-client/pull/8489)
|
2271 |
|
2272 | - Improve interaction between React hooks and React Fast Refresh in development. <br/>
|
2273 | [@andreialecu](https://github.com/andreialecu) in [#7952](https://github.com/apollographql/apollo-client/pull/7952)
|
2274 |
|
2275 | ### Potentially disruptive changes
|
2276 |
|
2277 | - To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4 automatically clears any `ROOT_MUTATION` fields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing the `keepRootFields: true` option to `client.mutate`. `ROOT_MUTATION` result data are also passed to the mutation `update` function, so we recommend obtaining the results that way, rather than using `keepRootFields: true`, if possible. <br/>
|
2278 | [@benjamn](https://github.com/benjamn) in [#8280](https://github.com/apollographql/apollo-client/pull/8280)
|
2279 |
|
2280 | - Internally, Apollo Client now controls the execution of development-only code using the `__DEV__` global variable, rather than `process.env.NODE_ENV`. While this change should not cause any visible differences in behavior, it will increase your minified+gzip bundle size by more than 3.5kB, unless you configure your minifier to replace `__DEV__` with a `true` or `false` constant, the same way you already replace `process.env.NODE_ENV` with a string literal like `"development"` or `"production"`. For an example of configuring a Create React App project without ejecting, see this pull request for our [React Apollo reproduction template](https://github.com/apollographql/react-apollo-error-template/pull/51). <br/>
|
2281 | [@benjamn](https://github.com/benjamn) in [#8347](https://github.com/apollographql/apollo-client/pull/8347)
|
2282 |
|
2283 | - Internally, Apollo Client now uses namespace syntax (e.g. `import * as React from "react"`) for imports whose types are re-exported (and thus may appear in `.d.ts` files). This change should remove any need to configure `esModuleInterop` or `allowSyntheticDefaultImports` in `tsconfig.json`, but might require updating bundler configurations that specify named exports of the `react` and `prop-types` packages, to include exports like `createContext` and `createElement` ([example](https://github.com/apollographql/apollo-client/commit/16b08e1af9ba9934041298496e167aafb128c15d)). <br/>
|
2284 | [@devrelm](https://github.com/devrelm) in [#7742](https://github.com/apollographql/apollo-client/pull/7742)
|
2285 |
|
2286 | - Respect `no-cache` fetch policy (by not reading any `data` from the cache) for `loading: true` results triggered by `notifyOnNetworkStatusChange: true`. <br />
|
2287 | [@jcreighton](https://github.com/jcreighton) in [#7761](https://github.com/apollographql/apollo-client/pull/7761)
|
2288 |
|
2289 | - The TypeScript return types of the `getLastResult` and `getLastError` methods of `ObservableQuery` now correctly include the possibility of returning `undefined`. If you happen to be calling either of these methods directly, you may need to adjust how the calling code handles the methods' possibly-`undefined` results. <br/>
|
2290 | [@benjamn](https://github.com/benjamn) in [#8394](https://github.com/apollographql/apollo-client/pull/8394)
|
2291 |
|
2292 | - Log non-fatal `invariant.error` message when fields are missing from result objects written into `InMemoryCache`, rather than throwing an exception. While this change relaxes an exception to be merely an error message, which is usually a backwards-compatible change, the error messages are logged in more cases now than the exception was previously thrown, and those new error messages may be worth investigating to discover potential problems in your application. The errors are not displayed for `@client`-only fields, so adding `@client` is one way to handle/hide the errors for local-only fields. Another general strategy is to use a more precise query to write specific subsets of data into the cache, rather than reusing a larger query that contains fields not present in the written `data`. <br/>
|
2293 | [@benjamn](https://github.com/benjamn) in [#8416](https://github.com/apollographql/apollo-client/pull/8416)
|
2294 |
|
2295 | - The [`nextFetchPolicy`](https://github.com/apollographql/apollo-client/pull/6893) option for `client.watchQuery` and `useQuery` will no longer be removed from the `options` object after it has been applied, and instead will continue to be applied any time `options.fetchPolicy` is reset to another value, until/unless the `options.nextFetchPolicy` property is removed from `options`. <br/>
|
2296 | [@benjamn](https://github.com/benjamn) in [#8465](https://github.com/apollographql/apollo-client/pull/8465)
|
2297 |
|
2298 | - The `fetchMore`, `subscribeToMore`, and `updateQuery` functions returned from the `useQuery` hook may now return undefined in edge cases where the functions are called when the component is unmounted <br/> [@noghartt](https://github.com/noghartt) in [#7980](https://github.com/apollographql/apollo-client/pull/7980).
|
2299 |
|
2300 | ### Bug fixes
|
2301 |
|
2302 | - In Apollo Client 2.x, a `refetch` operation would always replace existing data in the cache. With the introduction of field policy `merge` functions in Apollo Client 3, existing field values could be inappropriately combined with incoming field values by a custom `merge` function that does not realize a `refetch` has happened.
|
2303 |
|
2304 | To give you more control over this behavior, we have introduced an `overwrite?: boolean = false` option for `cache.writeQuery` and `cache.writeFragment`, and an option called `refetchWritePolicy?: "merge" | "overwrite"` for `client.watchQuery`, `useQuery`, and other functions that accept `WatchQueryOptions`. You can use these options to make sure any `merge` functions involved in cache writes for `refetch` operations get invoked with `undefined` as their first argument, which simulates the absence of any existing data, while still giving the `merge` function a chance to determine the internal representation of the incoming data.
|
2305 |
|
2306 | The default behaviors are `overwrite: true` and `refetchWritePolicy: "overwrite"`, which restores the Apollo Client 2.x behavior, but (if this change causes any problems for your application) you can easily recover the previous merging behavior by setting a default value for `refetchWritePolicy` in `defaultOptions.watchQuery`:
|
2307 |
|
2308 | ```ts
|
2309 | new ApolloClient({
|
2310 | defaultOptions: {
|
2311 | watchQuery: {
|
2312 | refetchWritePolicy: "merge",
|
2313 | },
|
2314 | },
|
2315 | });
|
2316 | ```
|
2317 |
|
2318 | [@benjamn](https://github.com/benjamn) in [#7810](https://github.com/apollographql/apollo-client/pull/7810)
|
2319 |
|
2320 | - Make sure the `MockedResponse` `ResultFunction` type is re-exported. <br/>
|
2321 | [@hwillson](https://github.com/hwillson) in [#8315](https://github.com/apollographql/apollo-client/pull/8315)
|
2322 |
|
2323 | - Fix polling when used with `skip`. <br/>
|
2324 | [@brainkim](https://github.com/brainkim) in [#8346](https://github.com/apollographql/apollo-client/pull/8346)
|
2325 |
|
2326 | - `InMemoryCache` now coalesces `EntityStore` updates to guarantee only one `store.merge(id, fields)` call per `id` per cache write. <br/>
|
2327 | [@benjamn](https://github.com/benjamn) in [#8372](https://github.com/apollographql/apollo-client/pull/8372)
|
2328 |
|
2329 | - Fix polling when used with `<React.StrictMode>`. <br/>
|
2330 | [@brainkim](https://github.com/brainkim) in [#8414](https://github.com/apollographql/apollo-client/pull/8414)
|
2331 |
|
2332 | - Fix the React integration logging `Warning: Can't perform a React state update on an unmounted component`. <br/>
|
2333 | [@wuarmin](https://github.com/wuarmin) in [#7745](https://github.com/apollographql/apollo-client/pull/7745)
|
2334 |
|
2335 | - Make `ObservableQuery#getCurrentResult` always call `queryInfo.getDiff()`. <br/>
|
2336 | [@benjamn](https://github.com/benjamn) in [#8422](https://github.com/apollographql/apollo-client/pull/8422)
|
2337 |
|
2338 | - Make `readField` default to reading from current object only when the `from` option/argument is actually omitted, not when `from` is passed to `readField` with an undefined value. A warning will be printed when this situation occurs. <br/>
|
2339 | [@benjamn](https://github.com/benjamn) in [#8508](https://github.com/apollographql/apollo-client/pull/8508)
|
2340 |
|
2341 | - The `fetchMore`, `subscribeToMore`, and `updateQuery` functions no longer throw `undefined` errors <br/> [@noghartt](https://github.com/noghartt) in [#7980](https://github.com/apollographql/apollo-client/pull/7980).
|
2342 |
|
2343 | ## Apollo Client 3.3.21
|
2344 |
|
2345 | ### Bug fixes
|
2346 |
|
2347 | - Fix race condition in `@apollo/client/link/context` that could leak subscriptions if the subscription is cancelled before `operation.setContext` is called. <br/>
|
2348 | [@sofianhn](https://github.com/sofianhn) in [#8399](https://github.com/apollographql/apollo-client/pull/8399)
|
2349 |
|
2350 | - Prefer `existing.pageInfo.startCursor` and `endCursor` (if defined) in `read` function of `relayStylePagination` policies. <br/>
|
2351 | [@benjamn](https://github.com/benjamn) in [#8438](https://github.com/apollographql/apollo-client/pull/8438)
|
2352 |
|
2353 | ### Improvements
|
2354 |
|
2355 | - Normalize user-provided `HttpLink` headers by lower-casing their names. <br/>
|
2356 | [@benjamn](https://github.com/benjamn) in [#8449](https://github.com/apollographql/apollo-client/pull/8449)
|
2357 |
|
2358 | ## Apollo Client 3.3.20
|
2359 |
|
2360 | ### Bug fixes
|
2361 |
|
2362 | - Fix policy merging bug when calling `cache.policies.addTypePolicies` multiple times for the same type policy. <br/>
|
2363 | [@Banou26](https://github.com/Banou26) in [#8361](https://github.com/apollographql/apollo-client/pull/8361)
|
2364 |
|
2365 | ## Apollo Client 3.3.19
|
2366 |
|
2367 | ### Bug fixes
|
2368 |
|
2369 | - Use `export ... from` syntax to re-export `graphql-tag` named exports, making tree-shaking easier for some bundlers. <br/>
|
2370 | [@benjamn](https://github.com/benjamn) in [#8221](https://github.com/apollographql/apollo-client/pull/8221)
|
2371 |
|
2372 | ### Documentation
|
2373 |
|
2374 | - Replace Spectrum references with [community.apollographql.com](https://community.apollographql.com). <br/>
|
2375 | [@hwillson](https://github.com/hwillson) in [#8238](https://github.com/apollographql/apollo-client/pull/8238)
|
2376 |
|
2377 | ## Apollo Client 3.3.18
|
2378 |
|
2379 | ### Bug fixes
|
2380 |
|
2381 | - Add `"sideEffects": false` to all generated/published `package.json` files, to improve dead code elimination for nested entry points like `@apollo/client/cache`. <br/>
|
2382 | [@benjamn](https://github.com/benjamn) in [#8213](https://github.com/apollographql/apollo-client/pull/8213)
|
2383 |
|
2384 | ## Apollo Client 3.3.17
|
2385 |
|
2386 | ### Bug fixes
|
2387 |
|
2388 | - Make `useReactiveVar(rv)` recheck the latest `rv()` value in its `useEffect` callback, and immediately update state if the value has already changed, rather than calling `rv.onNextChange(setValue)` to listen for future changes. <br/>
|
2389 | [@benjamn](https://github.com/benjamn) in [#8135](https://github.com/apollographql/apollo-client/pull/8135)
|
2390 |
|
2391 | ## Apollo Client 3.3.16
|
2392 |
|
2393 | ### Bug fixes
|
2394 |
|
2395 | - Prevent `undefined` mutation result in `useMutation`. <br/>
|
2396 | [@jcreighton](https://github.com/jcreighton) in [#8018](https://github.com/apollographql/apollo-client/pull/8018)
|
2397 |
|
2398 | - Fix `useReactiveVar` not rerendering for successive synchronous calls. <br/>
|
2399 | [@brainkim](https://github.com/brainkim) in [#8022](https://github.com/apollographql/apollo-client/pull/8022)
|
2400 |
|
2401 | - Support `batchDebounce` option for `BatchLink` and `BatchHttpLink`. <br/>
|
2402 | [@dannycochran](https://github.com/dannycochran) in [#8024](https://github.com/apollographql/apollo-client/pull/8024)
|
2403 |
|
2404 | ## Apollo Client 3.3.15
|
2405 |
|
2406 | - Increment `queryInfo.lastRequestId` only when making a network request through the `ApolloLink` chain, rather than every time `fetchQueryByPolicy` is called. <br/>
|
2407 | [@dannycochran](https://github.com/dannycochran) in [#7956](https://github.com/apollographql/apollo-client/pull/7956)
|
2408 |
|
2409 | - During server-side rendering, allow initial `useQuery` calls to return final `{ loading: false, data }` results when the cache already contains the necessary data. <br/>
|
2410 | [@benjamn](https://github.com/benjamn) in [#7983](https://github.com/apollographql/apollo-client/pull/7983)
|
2411 |
|
2412 | ## Apollo Client 3.3.14
|
2413 |
|
2414 | ### Improvements
|
2415 |
|
2416 | - Adjust TypeScript types to allow `keyFields` and `keyArgs` functions to return `false`. <br/>
|
2417 | [@CarsonF](https://github.com/CarsonF) and [@benjamn](https://github.com/benjamn) in [#7900](https://github.com/apollographql/apollo-client/pull/7900)
|
2418 |
|
2419 | ### Bug fixes
|
2420 |
|
2421 | - Prevent `RenderPromises` memory leak by calling `renderPromises.clear()` after `getMarkupFromTree` finishes. <br/>
|
2422 | [@benjamn](https://github.com/benjamn) in [#7943](https://github.com/apollographql/apollo-client/pull/7943)
|
2423 |
|
2424 | - Cancel pending notify timeout when stopping a `QueryInfo` object. <br/>
|
2425 | [@hollandThomas](https://github.com/hollandThomas) in [#7935](https://github.com/apollographql/apollo-client/pull/7935)
|
2426 |
|
2427 | - Fix infinite rendering bug related to `useSubscription`. <br/>
|
2428 | [@brainkim](https://github.com/brainkim) in [#7917](https://github.com/apollographql/apollo-client/pull/7917)
|
2429 |
|
2430 | ## Apollo Client 3.3.13
|
2431 |
|
2432 | ### Improvements
|
2433 |
|
2434 | - Add missing `context` option to `useSubscription`. <br />
|
2435 | [@jcreighton](https://github.com/jcreighton) in [#7860](https://github.com/apollographql/apollo-client/pull/7860)
|
2436 |
|
2437 | - Remove unnecessary TypeScript global `Observable<T>["@@observable"]` method declaration. <br/>
|
2438 | [@benjamn](https://github.com/benjamn) in [#7888](https://github.com/apollographql/apollo-client/pull/7888)
|
2439 |
|
2440 | - Prevent skipped/observerless `ObservableQuery`s from being refetched by `refetchQueries`. <br/>
|
2441 | [@dannycochran](https://github.com/dannycochran) in [#7877](https://github.com/apollographql/apollo-client/pull/7877)
|
2442 |
|
2443 | ## Apollo Client 3.3.12
|
2444 |
|
2445 | ### Bug fixes
|
2446 |
|
2447 | - Maintain serial ordering of `asyncMap` mapping function calls, and prevent potential unhandled `Promise` rejection errors. <br/>
|
2448 | [@benjamn](https://github.com/benjamn) in [#7818](https://github.com/apollographql/apollo-client/pull/7818)
|
2449 |
|
2450 | - Relax incompatible `children?: React.ReactElement` field type in `MockedProviderProps` interface. <br/>
|
2451 | [@kevinperaza](https://github.com/kevinperaza) in [#7833](https://github.com/apollographql/apollo-client/pull/7833)
|
2452 |
|
2453 | ## Apollo Client 3.3.11
|
2454 |
|
2455 | ### Bug fixes
|
2456 |
|
2457 | - Fix `useLazyQuery` `forceUpdate` loop regression introduced by [#7655](https://github.com/apollographql/apollo-client/pull/7655) in version 3.3.10. <br/>
|
2458 | [@benjamn](https://github.com/benjamn) in [#7715](https://github.com/apollographql/apollo-client/pull/7715)
|
2459 |
|
2460 | ## Apollo Client 3.3.10
|
2461 |
|
2462 | ### Bug fixes
|
2463 |
|
2464 | - Revert PR [#7276](https://github.com/apollographql/apollo-client/pull/7276), but test that garbage collection reclaims torn-down `ObservableQuery` objects. <br/>
|
2465 | [@benjamn](https://github.com/benjamn) in [#7695](https://github.com/apollographql/apollo-client/pull/7695)
|
2466 |
|
2467 | - Reset `QueryInfo.diff` and `QueryInfo.dirty` after canceling notify timeout in `QueryInfo.markResult` and `QueryInfo.markError`. <br/>
|
2468 | [@jcreighton](https://github.com/jcreighton) in [#7696](https://github.com/apollographql/apollo-client/pull/7696)
|
2469 |
|
2470 | ### Improvements
|
2471 |
|
2472 | - Avoid calling `forceUpdate` when component is unmounted. <br/>
|
2473 | [@DylanVann](https://github.com/DylanVann) in [#7655](https://github.com/apollographql/apollo-client/pull/7655)
|
2474 |
|
2475 | - The `codemods/` top-level directory has been moved into the `scripts/` directory. <br/>
|
2476 | [@benjamn](https://github.com/benjamn) in [#7675](https://github.com/apollographql/apollo-client/pull/7675)
|
2477 |
|
2478 | ## Apollo Client 3.3.9
|
2479 |
|
2480 | ### Bug Fixes
|
2481 |
|
2482 | - Prevent reactive variables from retaining otherwise unreachable `InMemoryCache` objects. <br/>
|
2483 | [@benjamn](https://github.com/benjamn) in [#7661](https://github.com/apollographql/apollo-client/pull/7661)
|
2484 |
|
2485 | ### Improvements
|
2486 |
|
2487 | - The [`graphql-tag`](https://www.npmjs.com/package/graphql-tag) dependency has been updated to version 2.12.0, after converting its repository to use TypeScript and ECMAScript module syntax. There should be no visible changes in behavior, though the internal changes seemed significant enough to mention here. <br/>
|
2488 | [@abdonrd](https://github.com/abdonrd) in [graphql-tag#273](https://github.com/apollographql/graphql-tag/pull/273) and
|
2489 | [@PowerKiKi](https://github.com/PowerKiKi) in [graphql-tag#325](https://github.com/apollographql/graphql-tag/pull/325)
|
2490 |
|
2491 | ## Apollo Client 3.3.8
|
2492 |
|
2493 | ### Bug Fixes
|
2494 |
|
2495 | - Catch updates in `useReactiveVar` with an additional check. <br/>
|
2496 | [@jcreighton](https://github.com/jcreighton) in [#7652](https://github.com/apollographql/apollo-client/pull/7652)
|
2497 |
|
2498 | - Reactivate forgotten reactive variables whenever `InMemoryCache` acquires its first watcher. <br/>
|
2499 | [@benjamn](https://github.com/benjamn) in [#7657](https://github.com/apollographql/apollo-client/pull/7657)
|
2500 |
|
2501 | - Backport `Symbol.species` fix for `Concast` and `ObservableQuery` from [`release-3.4`](https://github.com/apollographql/apollo-client/pull/7399), fixing subscriptions in React Native Android when the Hermes JavaScript engine is enabled (among other benefits). <br/>
|
2502 | [@benjamn](https://github.com/benjamn) in [#7403](https://github.com/apollographql/apollo-client/pull/7403) and [#7660](https://github.com/apollographql/apollo-client/pull/7660)
|
2503 |
|
2504 | ## Apollo Client 3.3.7
|
2505 |
|
2506 | ### Bug Fixes
|
2507 |
|
2508 | - Fix a regression due to [#7310](https://github.com/apollographql/apollo-client/pull/7310) that caused `loading` always to be `true` for `skip: true` results during server-side rendering. <br/>
|
2509 | [@rgrove](https://github.com/rgrove) in [#7567](https://github.com/apollographql/apollo-client/pull/7567)
|
2510 |
|
2511 | - Avoid duplicate `useReactiveVar` listeners when rendering in `React.StrictMode`. <br/>
|
2512 | [@jcreighton](https://github.com/jcreighton) in [#7581](https://github.com/apollographql/apollo-client/pull/7581)
|
2513 |
|
2514 | ### Improvements
|
2515 |
|
2516 | - Set `displayName` on `ApolloContext` objects for easier debugging. <br/>
|
2517 | [@dulmandakh](https://github.com/dulmandakh) in [#7550](https://github.com/apollographql/apollo-client/pull/7550)
|
2518 |
|
2519 | ## Apollo Client 3.3.6
|
2520 |
|
2521 | ### Bug Fixes
|
2522 |
|
2523 | - Immediately apply `queryType: true`, `mutationType: true`, and `subscriptionType: true` type policies, rather than waiting for the first time the policy is used, fixing a [regression](https://github.com/apollographql/apollo-client/issues/7443) introduced by [#7065](https://github.com/apollographql/apollo-client/pull/7065). <br/>
|
2524 | [@benjamn](https://github.com/benjamn) in [#7463](https://github.com/apollographql/apollo-client/pull/7463)
|
2525 |
|
2526 | - Check that `window` is defined even when `connectToDevTools` is `true`. <br/>
|
2527 | [@yasupeke](https://github.com/yasupeke) in [#7434](https://github.com/apollographql/apollo-client/pull/7434)
|
2528 |
|
2529 | ### Improvements
|
2530 |
|
2531 | - Replace stray `console.debug` (undefined in React Native) with `invariant.log`. <br/>
|
2532 | [@benjamn](https://github.com/benjamn) in [#7454](https://github.com/apollographql/apollo-client/pull/7454)
|
2533 |
|
2534 | - Suggest Firefox Apollo DevTools as well as the Chrome extension. <br/>
|
2535 | [@benjamn](https://github.com/benjamn) in [#7461](https://github.com/apollographql/apollo-client/pull/7461)
|
2536 |
|
2537 | ## Apollo Client 3.3.5
|
2538 |
|
2539 | ### Improvements
|
2540 |
|
2541 | - Restore `client.version` property, reflecting the current `@apollo/client` version from `package.json`. <br/>
|
2542 | [@benjamn](https://github.com/benjamn) in [#7448](https://github.com/apollographql/apollo-client/pull/7448)
|
2543 |
|
2544 | ## Apollo Client 3.3.4
|
2545 |
|
2546 | ### Improvements
|
2547 |
|
2548 | - Update `ts-invariant` to avoid potential [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)-violating `Function` fallback, thanks to [a clever new `globalThis` polyfill technique](https://mathiasbynens.be/notes/globalthis). <br/>
|
2549 | [@benjamn](https://github.com/benjamn) in [#7414](https://github.com/apollographql/apollo-client/pull/7414)
|
2550 |
|
2551 | ## Apollo Client 3.3.3
|
2552 |
|
2553 | ### Bug fixes
|
2554 |
|
2555 | - Make the `observer` parameter of `ApolloLink#onError` optional, fixing an unnecessary breaking change for any code that called `onError` directly. <br/>
|
2556 | [@benjamn](https://github.com/benjamn) in [#7407](https://github.com/apollographql/apollo-client/pull/7407)
|
2557 |
|
2558 | ## Apollo Client 3.3.2
|
2559 |
|
2560 | > ⚠️ **Note:** This version of `@apollo/client` contains no behavioral changes since version 3.3.1
|
2561 |
|
2562 | ### Documentation
|
2563 |
|
2564 | - The [Pagination](https://www.apollographql.com/docs/react/pagination/overview/) article has been completely rewritten (and split into multiple pages) to cover Apollo Client 3 field policies. <br/>
|
2565 | [@benjamn](https://github.com/benjamn) and [@StephenBarlow](https://github.com/StephenBarlow) in [#7175](https://github.com/apollographql/apollo-client/pull/7175)
|
2566 |
|
2567 | - Revamp [local state tutorial chapter](https://www.apollographql.com/tutorials/fullstack-quickstart/managing-local-state) for Apollo Client 3, including reactive variables. <br/>
|
2568 | [@StephenBarlow](https://github.com/StephenBarlow) in [`apollographql@apollo#1050`](https://github.com/apollographql/apollo/pull/1050)
|
2569 |
|
2570 | - Add examples of using `ApolloLink` to modify response data asynchronously. <br/>
|
2571 | [@alichry](https://github.com/alichry) in [#7332](https://github.com/apollographql/apollo-client/pull/7332)
|
2572 |
|
2573 | - Consolidate separate v2.4, v2.5, and v2.6 documentation versions into one v2 version. <br/>
|
2574 | [@jgarrow](https://github.com/jgarrow) in [#7378](https://github.com/apollographql/apollo-client/pull/7378)
|
2575 |
|
2576 | ## Apollo Client 3.3.1
|
2577 |
|
2578 | ### Bug Fixes
|
2579 |
|
2580 | - Revert back to `default`-importing `React` internally, rather than using a namespace import. <br/>
|
2581 | [@benjamn](https://github.com/benjamn) in [113475b1](https://github.com/apollographql/apollo-client/commit/113475b163a19a40a67465c11e8e6f48a1de7e76)
|
2582 |
|
2583 | ## Apollo Client 3.3.0
|
2584 |
|
2585 | ### Bug Fixes
|
2586 |
|
2587 | - Update `@wry/equality` to consider undefined properties equivalent to missing properties. <br/>
|
2588 | [@benjamn](https://github.com/benjamn) in [#7108](https://github.com/apollographql/apollo-client/pull/7108)
|
2589 |
|
2590 | - Prevent memory leaks involving unused `onBroadcast` function closure created in `ApolloClient` constructor. <br/>
|
2591 | [@kamilkisiela](https://github.com/kamilkisiela) in [#7161](https://github.com/apollographql/apollo-client/pull/7161)
|
2592 |
|
2593 | - Provide default empty cache object for root IDs like `ROOT_QUERY`, to avoid differences in behavior before/after `ROOT_QUERY` data has been written into `InMemoryCache`. <br/>
|
2594 | [@benjamn](https://github.com/benjamn) in [#7100](https://github.com/apollographql/apollo-client/pull/7100)
|
2595 |
|
2596 | - Cancel `queryInfo.notifyTimeout` in `QueryInfo#markResult` to prevent unnecessary network requests when using a `FetchPolicy` of `cache-and-network` or `network-only` in a React component with multiple `useQuery` calls. <br/>
|
2597 | [@benjamn](https://github.com/benjamn) in [#7347](https://github.com/apollographql/apollo-client/pull/7347)
|
2598 |
|
2599 | ### Potentially breaking changes
|
2600 |
|
2601 | - Ensure `cache.readQuery` and `cache.readFragment` always return `TData | null`, instead of throwing `MissingFieldError` exceptions when missing fields are encountered. <br/>
|
2602 | [@benjamn](https://github.com/benjamn) in [#7098](https://github.com/apollographql/apollo-client/pull/7098)
|
2603 |
|
2604 | > Since this change converts prior exceptions to `null` returns, and since `null` was already a possible return value according to the `TData | null` return type, we are confident this change will be backwards compatible (as long as `null` was properly handled before).
|
2605 |
|
2606 | - `HttpLink` will now automatically strip any unused `variables` before sending queries to the GraphQL server, since those queries are very likely to fail validation, according to the [All Variables Used](https://spec.graphql.org/draft/#sec-All-Variables-Used) rule in the GraphQL specification. If you depend on the preservation of unused variables, you can restore the previous behavior by passing `includeUnusedVariables: true` to the `HttpLink` constructor (which is typically passed as `options.link` to the `ApolloClient` constructor). <br/>
|
2607 | [@benjamn](https://github.com/benjamn) in [#7127](https://github.com/apollographql/apollo-client/pull/7127)
|
2608 |
|
2609 | - Ensure `MockLink` (used by `MockedProvider`) returns mock configuration errors (e.g. `No more mocked responses for the query ...`) through the Link's `Observable`, instead of throwing them. These errors are now available through the `error` property of a result. <br/>
|
2610 | [@hwillson](https://github.com/hwillson) in [#7110](https://github.com/apollographql/apollo-client/pull/7110)
|
2611 |
|
2612 | > Returning mock configuration errors through the Link's `Observable` was the default behavior in Apollo Client 2.x. We changed it for 3, but the change has been problematic for those looking to migrate from 2.x to 3. We've decided to change this back with the understanding that not many people want or are relying on `MockLink`'s throwing exception approach. If you want to change this functionality, you can define custom error handling through `MockLink.setOnError`.
|
2613 |
|
2614 | - Unsubscribing the last observer from an `ObservableQuery` will once again unsubscribe from the underlying network `Observable` in all cases, as in Apollo Client 2.x, allowing network requests to be cancelled by unsubscribing. <br/>
|
2615 | [@javier-garcia-meteologica](https://github.com/javier-garcia-meteologica) in [#7165](https://github.com/apollographql/apollo-client/pull/7165) and [#7170](https://github.com/apollographql/apollo-client/pull/7170).
|
2616 |
|
2617 | - The independent `QueryBaseOptions` and `ModifiableWatchQueryOptions` interface supertypes have been eliminated, and their fields are now defined by `QueryOptions`. <br/>
|
2618 | [@DCtheTall](https://github.com/DCtheTall) in [#7136](https://github.com/apollographql/apollo-client/pull/7136)
|
2619 |
|
2620 | - Internally, Apollo Client now avoids nested imports from the `graphql` package, importing everything from the top-level package instead. For example,
|
2621 | ```ts
|
2622 | import { visit } from "graphql/language/visitor";
|
2623 | ```
|
2624 | is now just
|
2625 | ```ts
|
2626 | import { visit } from "graphql";
|
2627 | ```
|
2628 | Since the `graphql` package uses `.mjs` modules, your bundler may need to be configured to recognize `.mjs` files as ECMAScript modules rather than CommonJS modules. <br/>
|
2629 | [@benjamn](https://github.com/benjamn) in [#7185](https://github.com/apollographql/apollo-client/pull/7185)
|
2630 |
|
2631 | ### Improvements
|
2632 |
|
2633 | - Support inheritance of type and field policies, according to `possibleTypes`. <br/>
|
2634 | [@benjamn](https://github.com/benjamn) in [#7065](https://github.com/apollographql/apollo-client/pull/7065)
|
2635 |
|
2636 | - Allow configuring custom `merge` functions, including the `merge: true` and `merge: false` shorthands, in type policies as well as field policies. <br/>
|
2637 | [@benjamn](https://github.com/benjamn) in [#7070](https://github.com/apollographql/apollo-client/pull/7070)
|
2638 |
|
2639 | - The verbosity of Apollo Client console messages can be globally adjusted using the `setLogVerbosity` function:
|
2640 |
|
2641 | ```ts
|
2642 | import { setLogVerbosity } from "@apollo/client";
|
2643 | setLogVerbosity("log"); // display all messages
|
2644 | setLogVerbosity("warn"); // display only warnings and errors (default)
|
2645 | setLogVerbosity("error"); // display only errors
|
2646 | setLogVerbosity("silent"); // hide all console messages
|
2647 | ```
|
2648 |
|
2649 | Remember that all logs, warnings, and errors are hidden in production. <br/>
|
2650 | [@benjamn](https://github.com/benjamn) in [#7226](https://github.com/apollographql/apollo-client/pull/7226)
|
2651 |
|
2652 | - Modifying `InMemoryCache` fields that have `keyArgs` configured will now invalidate only the field value with matching key arguments, rather than invalidating all field values that share the same field name. If `keyArgs` has not been configured, the cache must err on the side of invalidating by field name, as before. <br/>
|
2653 | [@benjamn](https://github.com/benjamn) in [#7351](https://github.com/apollographql/apollo-client/pull/7351)
|
2654 |
|
2655 | - Shallow-merge `options.variables` when combining existing or default options with newly-provided options, so new variables do not completely overwrite existing variables. <br/>
|
2656 | [@amannn](https://github.com/amannn) in [#6927](https://github.com/apollographql/apollo-client/pull/6927)
|
2657 |
|
2658 | - Avoid displaying `Cache data may be lost...` warnings for scalar field values that happen to be objects, such as JSON data. <br/>
|
2659 | [@benjamn](https://github.com/benjamn) in [#7075](https://github.com/apollographql/apollo-client/pull/7075)
|
2660 |
|
2661 | - In addition to the `result.data` property, `useQuery` and `useLazyQuery` will now provide a `result.previousData` property, which can be useful when a network request is pending and `result.data` is undefined, since `result.previousData` can be rendered instead of rendering an empty/loading state. <br/>
|
2662 | [@hwillson](https://github.com/hwillson) in [#7082](https://github.com/apollographql/apollo-client/pull/7082)
|
2663 |
|
2664 | - Passing `validate: true` to the `SchemaLink` constructor will enable validation of incoming queries against the local schema before execution, returning validation errors in `result.errors`, just like a non-local GraphQL endpoint typically would. <br/>
|
2665 | [@amannn](https://github.com/amannn) in [#7094](https://github.com/apollographql/apollo-client/pull/7094)
|
2666 |
|
2667 | - Allow optional arguments in `keyArgs: [...]` arrays for `InMemoryCache` field policies. <br/>
|
2668 | [@benjamn](https://github.com/benjamn) in [#7109](https://github.com/apollographql/apollo-client/pull/7109)
|
2669 |
|
2670 | - Avoid registering `QueryPromise` when `skip` is `true` during server-side rendering. <br/>
|
2671 | [@izumin5210](https://github.com/izumin5210) in [#7310](https://github.com/apollographql/apollo-client/pull/7310)
|
2672 |
|
2673 | - `ApolloCache` objects (including `InMemoryCache`) may now be associated with or disassociated from individual reactive variables by calling `reactiveVar.attachCache(cache)` and/or `reactiveVar.forgetCache(cache)`. <br/>
|
2674 | [@benjamn](https://github.com/benjamn) in [#7350](https://github.com/apollographql/apollo-client/pull/7350)
|
2675 |
|
2676 | ## Apollo Client 3.2.9
|
2677 |
|
2678 | ### Bug Fixes
|
2679 |
|
2680 | - Revert back to `default`-importing `React` internally, rather than using a namespace import. <br/>
|
2681 | [@benjamn](https://github.com/benjamn) in [113475b1](https://github.com/apollographql/apollo-client/commit/113475b163a19a40a67465c11e8e6f48a1de7e76)
|
2682 |
|
2683 | ## Apollo Client 3.2.8
|
2684 |
|
2685 | ### Bug Fixes
|
2686 |
|
2687 | - Ensure `sourcesContent` array is properly defined in `.js.map` files generated by `tsc`. <br/>
|
2688 | [@benjamn](https://github.com/benjamn) in [#7371](https://github.com/apollographql/apollo-client/pull/7371)
|
2689 |
|
2690 | - Avoid relying on global `Symbol` properties in `ApolloContext.ts`. <br/>
|
2691 | [@benjamn](https://github.com/benjamn) in [#7371](https://github.com/apollographql/apollo-client/pull/7371)
|
2692 |
|
2693 | ## Apollo Client 3.2.7
|
2694 |
|
2695 | ### Bug Fixes
|
2696 |
|
2697 | - Revert updating `symbol-observable` from version 2.x to version 3, which caused TypeScript errors with some `@types/node` versions, especially in Angular applications. <br/>
|
2698 | [@benjamn](https://github.com/benjamn) in [#7340](https://github.com/apollographql/apollo-client/pull/7340)
|
2699 |
|
2700 | ## Apollo Client 3.2.6
|
2701 |
|
2702 | ### Bug Fixes
|
2703 |
|
2704 | - Always consider singleton IDs like `ROOT_QUERY` and `ROOT_MUTATION` to be root IDs during `cache.gc` garbage collection, regardless of whether they have been retained or released. <br/>
|
2705 | [@benjamn](https://github.com/benjamn) in [#7333](https://github.com/apollographql/apollo-client/pull/7333)
|
2706 |
|
2707 | - Use optional chaining syntax (`this.currentObservable?.refetch`) in React `refetch` wrapper function to avoid crashing when an unmounted component is accidentally refetched. <br/>
|
2708 | [@tm1000](https://github.com/tm1000) in [#6314](https://github.com/apollographql/apollo-client/pull/6314) and
|
2709 | [@linmic](https://github.com/linmic) in [#7186](https://github.com/apollographql/apollo-client/pull/7186)
|
2710 |
|
2711 | ### Improvements
|
2712 |
|
2713 | - Handle older `react-apollo` package in `codemods/ac2-to-ac3/imports.js` migration script. <br/>
|
2714 | [@tm1000](https://github.com/tm1000) in [#7216](https://github.com/apollographql/apollo-client/pull/7216)
|
2715 |
|
2716 | - Ensure `relayStylePagination` preserves `pageInfo.{start,end}Cursor` if `edges` is missing or empty. <br/>
|
2717 | [@beaucollins](https://github.com/beaucollins) in [#7224](https://github.com/apollographql/apollo-client/pull/7224)
|
2718 |
|
2719 | ## Apollo Client 3.2.5
|
2720 |
|
2721 | ### Improvements
|
2722 |
|
2723 | - Move `terser` dependency from `dependencies` to `devDependencies`. <br/>
|
2724 | [@SimenB](https://github.com/SimenB) in [#7188](https://github.com/apollographql/apollo-client/pull/7188)
|
2725 |
|
2726 | - Avoid all sub-package imports from the `graphql` npm package. <br/>
|
2727 | [@stoically](https://github.com/stoically) in [#7185](https://github.com/apollographql/apollo-client/pull/7185)
|
2728 |
|
2729 | ## Apollo Client 3.2.4
|
2730 |
|
2731 | ### Improvements
|
2732 |
|
2733 | - Update the `optimism` npm dependency to version 0.13.0 in order to use the new `optimistic.forget` method to fix a potential `cache.watch` memory leak. <br/>
|
2734 | [@benjamn](https://github.com/benjamn) in [#7157](https://github.com/apollographql/apollo-client/pull/7157)
|
2735 |
|
2736 | - Consider `cache.reset` a destructive method, like `cache.evict` and `cache.modify`. <br/>
|
2737 | [@joshjg](https://github.com/joshjg) in [#7150](https://github.com/apollographql/apollo-client/pull/7150)
|
2738 |
|
2739 | - Avoid refetching observerless queries with `reFetchObservableQueries`. <br/>
|
2740 | [@joshjg](https://github.com/joshjg) in [#7146](https://github.com/apollographql/apollo-client/pull/7146)
|
2741 |
|
2742 | ## Apollo Client 3.2.3
|
2743 |
|
2744 | ### Improvements
|
2745 |
|
2746 | - Default `args.offset` to zero in `offsetLimitPagination`. <br/>
|
2747 | [@benjamn](https://github.com/benjamn) in [#7141](https://github.com/apollographql/apollo-client/pull/7141)
|
2748 |
|
2749 | ## Apollo Client 3.2.2
|
2750 |
|
2751 | ### Bug Fixes
|
2752 |
|
2753 | - Undo `TEdgeWrapper` approach for `relayStylePagination`, introduced by [f41e9efc](https://github.com/apollographql/apollo-client/commit/f41e9efc9e061b80fe5019456c049a3c56661e87) in [#7023](https://github.com/apollographql/apollo-client/pull/7023), since it was an unintended breaking change for existing code that used `cache.modify` to interact with field data managed by `relayStylePagination`. <br/>
|
2754 | [@benjamn](https://github.com/benjamn) in [#7103](https://github.com/apollographql/apollo-client/pull/7103)
|
2755 |
|
2756 | ## Apollo Client 3.2.1
|
2757 |
|
2758 | ### Bug Fixes
|
2759 |
|
2760 | - Fix `relayStylePagination` to handle the possibility that edges might be normalized `Reference` objects (uncommon). <br/>
|
2761 | [@anark](https://github.com/anark) and [@benjamn](https://github.com/benjamn) in [#7023](https://github.com/apollographql/apollo-client/pull/7023)
|
2762 |
|
2763 | - Disable "Missing cache result fields" warnings when `returnPartialData` is `true`. <br/>
|
2764 | [@hwillson](https://github.com/hwillson) in [#7055](https://github.com/apollographql/apollo-client/pull/7055)
|
2765 |
|
2766 | ### Improvements
|
2767 |
|
2768 | - Mark `subscriptions-transport-ws` `peerDependency` as optional. <br/>
|
2769 | [@MasterOdin](https://github.com/MasterOdin) in [#7047](https://github.com/apollographql/apollo-client/pull/7047)
|
2770 |
|
2771 | ## Apollo Client 3.2.0
|
2772 |
|
2773 | ### Bug Fixes
|
2774 |
|
2775 | - Use `options.nextFetchPolicy` internally to restore original `FetchPolicy` after polling with `fetchPolicy: "network-only"`, so that polling does not interfere with normal query watching. <br/>
|
2776 | [@benjamn](https://github.com/benjamn) in [#6893](https://github.com/apollographql/apollo-client/pull/6893)
|
2777 |
|
2778 | - Initialize `ObservableQuery` in `updateObservableQuery` even if `skip` is `true`. <br/>
|
2779 | [@mu29](https://github.com/mu29) in [#6999](https://github.com/apollographql/apollo-client/pull/6999)
|
2780 |
|
2781 | - Prevent full reobservation of queries affected by optimistic mutation updates, while still delivering results from the cache. <br/>
|
2782 | [@benjamn](https://github.com/benjamn) in [#6854](https://github.com/apollographql/apollo-client/pull/6854)
|
2783 |
|
2784 | ### Improvements
|
2785 |
|
2786 | - In TypeScript, all APIs that take `DocumentNode` parameters now may alternatively take `TypeDocumentNode<Data, Variables>`. This type has the same JavaScript representation but allows the APIs to infer the data and variable types instead of requiring you to specify types explicitly at the call site. <br/>
|
2787 | [@dotansimha](https://github.com/dotansimha) in [#6720](https://github.com/apollographql/apollo-client/pull/6720)
|
2788 |
|
2789 | - Bring back an improved form of heuristic fragment matching, by allowing `possibleTypes` to specify subtype regular expression strings, which count as matches if the written result object has all the fields expected for the fragment. <br/>
|
2790 | [@benjamn](https://github.com/benjamn) in [#6901](https://github.com/apollographql/apollo-client/pull/6901)
|
2791 |
|
2792 | - Allow `options.nextFetchPolicy` to be a function that takes the current `FetchPolicy` and returns a new (or the same) `FetchPolicy`, making `nextFetchPolicy` more suitable for global use in `defaultOptions.watchQuery`. <br/>
|
2793 | [@benjamn](https://github.com/benjamn) in [#6893](https://github.com/apollographql/apollo-client/pull/6893)
|
2794 |
|
2795 | - Implement `useReactiveVar` hook for consuming reactive variables in React components. <br/>
|
2796 | [@benjamn](https://github.com/benjamn) in [#6867](https://github.com/apollographql/apollo-client/pull/6867)
|
2797 |
|
2798 | - Move `apollo-link-persisted-queries` implementation to `@apollo/client/link/persisted-queries`. Try running our [automated imports transform](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3) to handle this conversion, if you're using `apollo-link-persisted-queries`. <br/>
|
2799 | [@hwillson](https://github.com/hwillson) in [#6837](https://github.com/apollographql/apollo-client/pull/6837)
|
2800 |
|
2801 | - Disable feud-stopping logic after any `cache.evict` or `cache.modify` operation. <br/>
|
2802 | [@benjamn](https://github.com/benjamn) in
|
2803 | [#6817](https://github.com/apollographql/apollo-client/pull/6817) and
|
2804 | [#6898](https://github.com/apollographql/apollo-client/pull/6898)
|
2805 |
|
2806 | - Throw if `writeFragment` cannot identify `options.data` when no `options.id` provided. <br/>
|
2807 | [@jcreighton](https://github.com/jcreighton) in [#6859](https://github.com/apollographql/apollo-client/pull/6859)
|
2808 |
|
2809 | - Provide `options.storage` object to `cache.modify` functions, as provided to `read` and `merge` functions. <br/>
|
2810 | [@benjamn](https://github.com/benjamn) in [#6991](https://github.com/apollographql/apollo-client/pull/6991)
|
2811 |
|
2812 | - Allow `cache.modify` functions to return `details.INVALIDATE` (similar to `details.DELETE`) to invalidate the current field, causing affected queries to rerun, even if the field's value is unchanged. <br/>
|
2813 | [@benjamn](https://github.com/benjamn) in [#6991](https://github.com/apollographql/apollo-client/pull/6991)
|
2814 |
|
2815 | - Support non-default `ErrorPolicy` values (that is, `"ignore"` and `"all"`, in addition to the default value `"none"`) for mutations and subscriptions, like we do for queries. <br/>
|
2816 | [@benjamn](https://github.com/benjamn) in [#7003](https://github.com/apollographql/apollo-client/pull/7003)
|
2817 |
|
2818 | - Remove invariant forbidding a `FetchPolicy` of `cache-only` in `ObservableQuery#refetch`. <br/>
|
2819 | [@benjamn](https://github.com/benjamn) in [ccb0a79a](https://github.com/apollographql/apollo-client/pull/6774/commits/ccb0a79a588721f08bf87a131c31bf37fa3238e5), fixing [#6702](https://github.com/apollographql/apollo-client/issues/6702)
|
2820 |
|
2821 | ## Apollo Client 3.1.5
|
2822 |
|
2823 | ### Bug Fixes
|
2824 |
|
2825 | - Make `ApolloQueryResult.data` field non-optional again. <br/>
|
2826 | [@benjamn](https://github.com/benjamn) in [#6997](https://github.com/apollographql/apollo-client/pull/6997)
|
2827 |
|
2828 | ### Improvements
|
2829 |
|
2830 | - Allow querying `Connection` metadata without `args` in `relayStylePagination`. <br/>
|
2831 | [@anark](https://github.com/anark) in [#6935](https://github.com/apollographql/apollo-client/pull/6935)
|
2832 |
|
2833 | ## Apollo Client 3.1.4
|
2834 |
|
2835 | ### Bug Fixes
|
2836 |
|
2837 | - Restrict root object identification to `ROOT_QUERY` (the ID corresponding to the root `Query` object), allowing `Mutation` and `Subscription` as user-defined types. <br/>
|
2838 | [@benjamn](https://github.com/benjamn) in [#6914](https://github.com/apollographql/apollo-client/pull/6914)
|
2839 |
|
2840 | - Prevent crash when `pageInfo` and empty `edges` are received by `relayStylePagination`. <br/>
|
2841 | [@fracmak](https://github.com/fracmak) in [#6918](https://github.com/apollographql/apollo-client/pull/6918)
|
2842 |
|
2843 | ## Apollo Client 3.1.3
|
2844 |
|
2845 | ### Bug Fixes
|
2846 |
|
2847 | - Consider only `result.data` (rather than all properties of `result`) when settling cache feuds. <br/>
|
2848 | [@danReynolds](https://github.com/danReynolds) in [#6777](https://github.com/apollographql/apollo-client/pull/6777)
|
2849 |
|
2850 | ### Improvements
|
2851 |
|
2852 | - Provide [jscodeshift](https://www.npmjs.com/package/jscodeshift) transform for automatically converting Apollo Client 2.x `import` declarations to use Apollo Client 3.x packages. [Instructions](https://github.com/apollographql/apollo-client/tree/main/scripts/codemods/ac2-to-ac3). <br/>
|
2853 | [@dminkovsky](https://github.com/dminkovsky) and [@jcreighton](https://github.com/jcreighton) in [#6486](https://github.com/apollographql/apollo-client/pull/6486)
|
2854 |
|
2855 | ## Apollo Client 3.1.2
|
2856 |
|
2857 | ### Bug Fixes
|
2858 |
|
2859 | - Avoid making network requests when `skip` is `true`. <br/>
|
2860 | [@hwillson](https://github.com/hwillson) in [#6752](https://github.com/apollographql/apollo-client/pull/6752)
|
2861 |
|
2862 | ### Improvements
|
2863 |
|
2864 | - Allow `SchemaLink.Options.context` function to be `async` (or return a `Promise`). <br/>
|
2865 | [@benjamn](https://github.com/benjamn) in [#6735](https://github.com/apollographql/apollo-client/pull/6735)
|
2866 |
|
2867 | ## Apollo Client 3.1.1
|
2868 |
|
2869 | ### Bug Fixes
|
2870 |
|
2871 | - Re-export cache types from `@apollo/client/core` (and thus also `@apollo/client`), again. <br/>
|
2872 | [@benjamn](https://github.com/benjamn) in [#6725](https://github.com/apollographql/apollo-client/pull/6725)
|
2873 |
|
2874 | ## Apollo Client 3.1.0
|
2875 |
|
2876 | ### Bug Fixes
|
2877 |
|
2878 | - Rework interdependencies between `@apollo/client/*` entry points, so that CommonJS and ESM modules are supported equally well, without any duplication of shared code. <br/>
|
2879 | [@benjamn](https://github.com/benjamn) in [#6656](https://github.com/apollographql/apollo-client/pull/6656) and
|
2880 | [#6657](https://github.com/apollographql/apollo-client/pull/6657)
|
2881 |
|
2882 | - Tolerate `!==` callback functions (like `onCompleted` and `onError`) in `useQuery` options, since those functions are almost always freshly evaluated each time `useQuery` is called. <br/>
|
2883 | [@hwillson](https://github.com/hwillson) and [@benjamn](https://github.com/benjamn) in [#6588](https://github.com/apollographql/apollo-client/pull/6588)
|
2884 |
|
2885 | - Respect `context.queryDeduplication` if provided, and otherwise fall back to `client.deduplication` (as before). <br/>
|
2886 | [@igaloly](https://github.com/igaloly) in [#6261](https://github.com/apollographql/apollo-client/pull/6261) and
|
2887 | [@Kujawadl](https://github.com/Kujawadl) in [#6526](https://github.com/apollographql/apollo-client/pull/6526)
|
2888 |
|
2889 | - Refactor `ObservableQuery#getCurrentResult` to reenable immediate delivery of warm cache results. As part of this refactoring, the `ApolloCurrentQueryResult` type was eliminated in favor of `ApolloQueryResult`. <br/>
|
2890 | [@benjamn](https://github.com/benjamn) in [#6710](https://github.com/apollographql/apollo-client/pull/6710)
|
2891 |
|
2892 | - Avoid clobbering `defaultOptions` with `undefined` values. <br/>
|
2893 | [@benjamn](https://github.com/benjamn) in [#6715](https://github.com/apollographql/apollo-client/pull/6715)
|
2894 |
|
2895 | ### Improvements
|
2896 |
|
2897 | - Apollo Client will no longer modify `options.fetchPolicy` unless you pass `options.nextFetchPolicy` to request an explicit change in `FetchPolicy` after the current request. Although this is technically a breaking change, `options.nextFieldPolicy` makes it easy to restore the old behavior (by passing `cache-first`). <br/>
|
2898 | [@benjamn](https://github.com/benjamn) in [#6712](https://github.com/apollographql/apollo-client/pull/6712), reverting [#6353](https://github.com/apollographql/apollo-client/pull/6353)
|
2899 |
|
2900 | - Errors of the form `Invariant Violation: 42` thrown in production can now be looked up much more easily, by consulting the auto-generated `@apollo/client/invariantErrorCodes.js` file specific to your `@apollo/client` version. <br/>
|
2901 | [@benjamn](https://github.com/benjamn) in [#6665](https://github.com/apollographql/apollo-client/pull/6665)
|
2902 |
|
2903 | - Make the `client` field of the `MutationResult` type non-optional, since it is always provided. <br/>
|
2904 | [@glasser](https://github.com/glasser) in [#6617](https://github.com/apollographql/apollo-client/pull/6617)
|
2905 |
|
2906 | - Allow passing an asynchronous `options.renderFunction` to `getMarkupFromTree`. <br/>
|
2907 | [@richardscarrott](https://github.com/richardscarrott) in [#6576](https://github.com/apollographql/apollo-client/pull/6576)
|
2908 |
|
2909 | - Ergonomic improvements for `merge` and `keyArgs` functions in cache field policies. <br/>
|
2910 | [@benjamn](https://github.com/benjamn) in [#6714](https://github.com/apollographql/apollo-client/pull/6714)
|
2911 |
|
2912 | ## Apollo Client 3.0.2
|
2913 |
|
2914 | ### Bug Fixes
|
2915 |
|
2916 | - Avoid duplicating `graphql/execution/execute` dependency in CommonJS bundle for `@apollo/client/link/schema`, fixing `instanceof` errors reported in [#6621](https://github.com/apollographql/apollo-client/issues/6621) and [#6614](https://github.com/apollographql/apollo-client/issues/6614). <br/>
|
2917 | [@benjamn](https://github.com/benjamn) in [#6624](https://github.com/apollographql/apollo-client/pull/6624)
|
2918 |
|
2919 | ## Apollo Client 3.0.1
|
2920 |
|
2921 | ### Bug Fixes
|
2922 |
|
2923 | - Make sure `useQuery` `onCompleted` is not fired when `skip` is `true`. <br/>
|
2924 | [@hwillson](https://github.com/hwillson) in [#6589](https://github.com/apollographql/apollo-client/pull/6589)
|
2925 |
|
2926 | - Revert changes to `peerDependencies` in `package.json` ([#6594](https://github.com/apollographql/apollo-client/pull/6594)), which would have allowed using incompatible future versions of `graphql` and/or `react` due to overly-permissive `>=` version constraints. <br/>
|
2927 | [@hwillson](https://github.com/hwillson) in [#6605](https://github.com/apollographql/apollo-client/pull/6605)
|
2928 |
|
2929 | # Apollo Client 3.0.0
|
2930 |
|
2931 | ## Improvements
|
2932 |
|
2933 | > ⚠️ **Note:** As of 3.0.0, Apollo Client uses a new package name: [`@apollo/client`](https://www.npmjs.com/package/@apollo/client)
|
2934 |
|
2935 | ### `ApolloClient`
|
2936 |
|
2937 | - **[BREAKING]** `ApolloClient` is now only available as a named export. The default `ApolloClient` export has been removed. <br/>
|
2938 | [@hwillson](https://github.com/hwillson) in [#5425](https://github.com/apollographql/apollo-client/pull/5425)
|
2939 |
|
2940 | - **[BREAKING]** The `queryManager` property of `ApolloClient` instances is now marked as `private`, paving the way for a more aggressive redesign of its API.
|
2941 |
|
2942 | - **[BREAKING]** Apollo Client will no longer deliver "stale" results to `ObservableQuery` consumers, but will instead log more helpful errors about which cache fields were missing. <br/>
|
2943 | [@benjamn](https://github.com/benjamn) in [#6058](https://github.com/apollographql/apollo-client/pull/6058)
|
2944 |
|
2945 | - **[BREAKING]** `ApolloError`'s thrown by Apollo Client no longer prefix error messages with `GraphQL error:` or `Network error:`. To differentiate between GraphQL/network errors, refer to `ApolloError`'s public `graphQLErrors` and `networkError` properties. <br/>
|
2946 | [@lorensr](https://github.com/lorensr) in [#3892](https://github.com/apollographql/apollo-client/pull/3892)
|
2947 |
|
2948 | - **[BREAKING]** Support for the `@live` directive has been removed, but might be restored in the future if a more thorough implementation is proposed. <br/>
|
2949 | [@benjamn](https://github.com/benjamn) in [#6221](https://github.com/apollographql/apollo-client/pull/6221)
|
2950 |
|
2951 | - **[BREAKING]** Apollo Client 2.x allowed `@client` fields to be passed into the `link` chain if `resolvers` were not set in the constructor. This allowed `@client` fields to be passed into Links like `apollo-link-state`. Apollo Client 3 enforces that `@client` fields are local only, meaning they are no longer passed into the `link` chain, under any circumstances. <br/>
|
2952 | [@hwillson](https://github.com/hwillson) in [#5982](https://github.com/apollographql/apollo-client/pull/5982)
|
2953 |
|
2954 | - **[BREAKING?]** Refactor `QueryManager` to make better use of observables and enforce `fetchPolicy` more reliably. <br/>
|
2955 | [@benjamn](https://github.com/benjamn) in [#6221](https://github.com/apollographql/apollo-client/pull/6221)
|
2956 |
|
2957 | - The `updateQuery` function previously required by `fetchMore` has been deprecated with a warning, and will be removed in the next major version of Apollo Client. Please consider using a `merge` function to handle incoming data instead of relying on `updateQuery`. <br/>
|
2958 | [@benjamn](https://github.com/benjamn) in [#6464](https://github.com/apollographql/apollo-client/pull/6464)
|
2959 |
|
2960 | - Helper functions for generating common pagination-related field policies may be imported from `@apollo/client/utilities`. The most basic helper is `concatPagination`, which emulates the concatenation behavior of typical `updateQuery` functions. A more sophisticated helper is `offsetLimitPagination`, which implements offset/limit-based pagination. If you are consuming paginated data from a Relay-friendly API, use `relayStylePagination`. Feel free to use [these helper functions](https://github.com/apollographql/apollo-client/blob/main/src/utilities/policies/pagination.ts) as inspiration for your own field policies, and/or modify them to suit your needs. <br/>
|
2961 | [@benjamn](https://github.com/benjamn) in [#6465](https://github.com/apollographql/apollo-client/pull/6465)
|
2962 |
|
2963 | - Updated to work with `graphql@15`. <br/>
|
2964 | [@durchanek](https://github.com/durchanek) in [#6194](https://github.com/apollographql/apollo-client/pull/6194) and [#6279](https://github.com/apollographql/apollo-client/pull/6279) <br/>
|
2965 | [@hagmic](https://github.com/hagmic) in [#6328](https://github.com/apollographql/apollo-client/pull/6328)
|
2966 |
|
2967 | - Apollo Link core and HTTP related functionality has been merged into `@apollo/client`. Functionality that was previously available through the `apollo-link`, `apollo-link-http-common` and `apollo-link-http` packages is now directly available from `@apollo/client` (e.g. `import { HttpLink } from '@apollo/client'`). The `ApolloClient` constructor has also been updated to accept new `uri`, `headers` and `credentials` options. If `uri` is specified, Apollo Client will take care of creating the necessary `HttpLink` behind the scenes. <br/>
|
2968 | [@hwillson](https://github.com/hwillson) in [#5412](https://github.com/apollographql/apollo-client/pull/5412)
|
2969 |
|
2970 | - The `gql` template tag should now be imported from the `@apollo/client` package, rather than the `graphql-tag` package. Although the `graphql-tag` package still works for now, future versions of `@apollo/client` may change the implementation details of `gql` without a major version bump. <br/>
|
2971 | [@hwillson](https://github.com/hwillson) in [#5451](https://github.com/apollographql/apollo-client/pull/5451)
|
2972 |
|
2973 | - `@apollo/client/core` can be used to import the Apollo Client core, which includes everything the main `@apollo/client` package does, except for all React related functionality. <br/>
|
2974 | [@kamilkisiela](https://github.com/kamilkisiela) in [#5541](https://github.com/apollographql/apollo-client/pull/5541)
|
2975 |
|
2976 | - Several deprecated methods have been fully removed:
|
2977 |
|
2978 | - `ApolloClient#initQueryManager`
|
2979 | - `QueryManager#startQuery`
|
2980 | - `ObservableQuery#currentResult`
|
2981 |
|
2982 | - Apollo Client now supports setting a new `ApolloLink` (or link chain) after `new ApolloClient()` has been called, using the `ApolloClient#setLink` method. <br/>
|
2983 | [@hwillson](https://github.com/hwillson) in [#6193](https://github.com/apollographql/apollo-client/pull/6193)
|
2984 |
|
2985 | - The final time a mutation `update` function is called, it can no longer accidentally read optimistic data from other concurrent mutations, which ensures the use of optimistic updates has no lasting impact on the state of the cache after mutations have finished. <br/>
|
2986 | [@benjamn](https://github.com/benjamn) in [#6551](https://github.com/apollographql/apollo-client/pull/6551)
|
2987 |
|
2988 | - Apollo links that were previously maintained in https://github.com/apollographql/apollo-link have been merged into the Apollo Client project. They should be accessed using the new entry points listed in the [migration guide](./docs/source/migrating/apollo-client-3-migration.md). <br/>
|
2989 | [@hwillson](https://github.com/hwillson) in [#](TODO)
|
2990 |
|
2991 | ### `InMemoryCache`
|
2992 |
|
2993 | > ⚠️ **Note:** `InMemoryCache` has been significantly redesigned and rewritten in Apollo Client 3.0. Please consult the [migration guide](https://www.apollographql.com/docs/react/v3.0-beta/migrating/apollo-client-3-migration/#cache-improvements) and read the new [documentation](https://www.apollographql.com/docs/react/v3.0-beta/caching/cache-configuration/) to understand everything that has been improved.
|
2994 |
|
2995 | - The `InMemoryCache` constructor should now be imported directly from `@apollo/client`, rather than from a separate package. The `apollo-cache-inmemory` package is no longer supported.
|
2996 |
|
2997 | > The `@apollo/client/cache` entry point can be used to import `InMemoryCache` without importing other parts of the Apollo Client codebase. <br/> > [@hwillson](https://github.com/hwillson) in [#5577](https://github.com/apollographql/apollo-client/pull/5577)
|
2998 |
|
2999 | - **[BREAKING]** `FragmentMatcher`, `HeuristicFragmentMatcher`, and `IntrospectionFragmentMatcher` have all been removed. We now recommend using `InMemoryCache`’s `possibleTypes` option instead. For more information see the [Defining `possibleTypes` manually](https://www.apollographql.com/docs/react/v3.0-beta/data/fragments/#defining-possibletypes-manually) section of the docs. <br/>
|
3000 | [@benjamn](https://github.com/benjamn) in [#5073](https://github.com/apollographql/apollo-client/pull/5073)
|
3001 |
|
3002 | - **[BREAKING]** As promised in the [Apollo Client 2.6 blog post](https://blog.apollographql.com/whats-new-in-apollo-client-2-6-b3acf28ecad1), all cache results are now frozen/immutable. <br/>
|
3003 | [@benjamn](https://github.com/benjamn) in [#5153](https://github.com/apollographql/apollo-client/pull/5153)
|
3004 |
|
3005 | - **[BREAKING]** Eliminate "generated" cache IDs to avoid normalizing objects with no meaningful ID, significantly reducing cache memory usage. This might be a backwards-incompatible change if your code depends on the precise internal representation of normalized data in the cache. <br/>
|
3006 | [@benjamn](https://github.com/benjamn) in [#5146](https://github.com/apollographql/apollo-client/pull/5146)
|
3007 |
|
3008 | - **[BREAKING]** `InMemoryCache` will no longer merge the fields of written objects unless the objects are known to have the same identity, and the values of fields with the same name will not be recursively merged unless a custom `merge` function is defined by a field policy for that field, within a type policy associated with the `__typename` of the parent object. <br/>
|
3009 | [@benjamn](https://github.com/benjamn) in [#5603](https://github.com/apollographql/apollo-client/pull/5603)
|
3010 |
|
3011 | - **[BREAKING]** `InMemoryCache` now _throws_ when data with missing or undefined query fields is written into the cache, rather than just warning in development. <br/>
|
3012 | [@benjamn](https://github.com/benjamn) in [#6055](https://github.com/apollographql/apollo-client/pull/6055)
|
3013 |
|
3014 | - **[BREAKING]** `client|cache.writeData` have been fully removed. `writeData` usage is one of the easiest ways to turn faulty assumptions about how the cache represents data internally, into cache inconsistency and corruption. `client|cache.writeQuery`, `client|cache.writeFragment`, and/or `cache.modify` can be used to update the cache. <br/>
|
3015 | [@benjamn](https://github.com/benjamn) in [#5923](https://github.com/apollographql/apollo-client/pull/5923)
|
3016 |
|
3017 | - `InMemoryCache` now supports tracing garbage collection and eviction. Note that the signature of the `evict` method has been simplified in a potentially backwards-incompatible way. <br/>
|
3018 | [@benjamn](https://github.com/benjamn) in [#5310](https://github.com/apollographql/apollo-client/pull/5310)
|
3019 |
|
3020 | - **[beta-BREAKING]** Please note that the `cache.evict` method now requires `Cache.EvictOptions`, though it previously supported positional arguments as well. <br/>
|
3021 | [@danReynolds](https://github.com/danReynolds) in [#6141](https://github.com/apollographql/apollo-client/pull/6141)
|
3022 | [@benjamn](https://github.com/benjamn) in [#6364](https://github.com/apollographql/apollo-client/pull/6364)
|
3023 |
|
3024 | - Removing an entity object using the `cache.evict` method does not automatically remove dangling references to that entity elsewhere in the cache, but dangling references will be automatically filtered from lists whenever those lists are read from the cache. You can define a custom field `read` function to customize this behavior. See [#6412](https://github.com/apollographql/apollo-client/pull/6412), [#6425](https://github.com/apollographql/apollo-client/pull/6425), and [#6454](https://github.com/apollographql/apollo-client/pull/6454) for further explanation.
|
3025 |
|
3026 | - Cache methods that would normally trigger a broadcast, like `cache.evict`, `cache.writeQuery`, and `cache.writeFragment`, can now be called with a named options object, which supports a `broadcast: boolean` property that can be used to silence the broadcast, for situations where you want to update the cache multiple times without triggering a broadcast each time. <br/>
|
3027 | [@benjamn](https://github.com/benjamn) in [#6288](https://github.com/apollographql/apollo-client/pull/6288)
|
3028 |
|
3029 | - `InMemoryCache` now `console.warn`s in development whenever non-normalized data is dangerously overwritten, with helpful links to documentation about normalization and custom `merge` functions. <br/>
|
3030 | [@benjamn](https://github.com/benjamn) in [#6372](https://github.com/apollographql/apollo-client/pull/6372)
|
3031 |
|
3032 | - The result caching system (introduced in [#3394](https://github.com/apollographql/apollo-client/pull/3394)) now tracks dependencies at the field level, rather than at the level of whole entity objects, allowing the cache to return identical (`===`) results much more often than before. <br/>
|
3033 | [@benjamn](https://github.com/benjamn) in [#5617](https://github.com/apollographql/apollo-client/pull/5617)
|
3034 |
|
3035 | - `InMemoryCache` now has a method called `modify` which can be used to update the value of a specific field within a specific entity object:
|
3036 |
|
3037 | ```ts
|
3038 | cache.modify({
|
3039 | id: cache.identify(post),
|
3040 | fields: {
|
3041 | comments(comments: Reference[], { readField }) {
|
3042 | return comments.filter(
|
3043 | (comment) => idToRemove !== readField("id", comment)
|
3044 | );
|
3045 | },
|
3046 | },
|
3047 | });
|
3048 | ```
|
3049 |
|
3050 | This API gracefully handles cases where multiple field values are associated with a single field name, and also removes the need for updating the cache by reading a query or fragment, modifying the result, and writing the modified result back into the cache. Behind the scenes, the `cache.evict` method is now implemented in terms of `cache.modify`. <br/>
|
3051 | [@benjamn](https://github.com/benjamn) in [#5909](https://github.com/apollographql/apollo-client/pull/5909)
|
3052 | and [#6178](https://github.com/apollographql/apollo-client/pull/6178)
|
3053 |
|
3054 | - `InMemoryCache` provides a new API for storing client state that can be updated from anywhere:
|
3055 |
|
3056 | ```ts
|
3057 | import { makeVar } from "@apollo/client";
|
3058 | const v = makeVar(123);
|
3059 | console.log(v()); // 123
|
3060 | console.log(v(v() + 1)); // 124
|
3061 | console.log(v()); // 124
|
3062 | v("asdf"); // TS type error
|
3063 | ```
|
3064 |
|
3065 | These variables are _reactive_ in the sense that updating their values invalidates any previously cached query results that depended on the old values. <br/>
|
3066 | [@benjamn](https://github.com/benjamn) in
|
3067 | [#5799](https://github.com/apollographql/apollo-client/pull/5799),
|
3068 | [#5976](https://github.com/apollographql/apollo-client/pull/5976), and
|
3069 | [#6512](https://github.com/apollographql/apollo-client/pull/6512)
|
3070 |
|
3071 | - Various cache read and write performance optimizations, cutting read and write times by more than 50% in larger benchmarks. <br/>
|
3072 | [@benjamn](https://github.com/benjamn) in [#5948](https://github.com/apollographql/apollo-client/pull/5948)
|
3073 |
|
3074 | - The `cache.readQuery` and `cache.writeQuery` methods now accept an `options.id` string, which eliminates most use cases for `cache.readFragment` and `cache.writeFragment`, and skips the implicit conversion of fragment documents to query documents performed by `cache.{read,write}Fragment`. <br/>
|
3075 | [@benjamn](https://github.com/benjamn) in [#5930](https://github.com/apollographql/apollo-client/pull/5930)
|
3076 |
|
3077 | - Support `cache.identify(entity)` for easily computing entity ID strings. <br/>
|
3078 | [@benjamn](https://github.com/benjamn) in [#5642](https://github.com/apollographql/apollo-client/pull/5642)
|
3079 |
|
3080 | - Support eviction of specific entity fields using `cache.evict(id, fieldName)`. <br/>
|
3081 | [@benjamn](https://github.com/benjamn) in [#5643](https://github.com/apollographql/apollo-client/pull/5643)
|
3082 |
|
3083 | - Make `InMemoryCache#evict` remove data from all `EntityStore` layers. <br/>
|
3084 | [@benjamn](https://github.com/benjamn) in [#5773](https://github.com/apollographql/apollo-client/pull/5773)
|
3085 |
|
3086 | - Stop paying attention to `previousResult` in `InMemoryCache`. <br/>
|
3087 | [@benjamn](https://github.com/benjamn) in [#5644](https://github.com/apollographql/apollo-client/pull/5644)
|
3088 |
|
3089 | - Improve optimistic update performance by limiting cache key diversity. <br/>
|
3090 | [@benjamn](https://github.com/benjamn) in [#5648](https://github.com/apollographql/apollo-client/pull/5648)
|
3091 |
|
3092 | - Custom field `read` functions can read from neighboring fields using the `readField(fieldName)` helper, and may also read fields from other entities by calling `readField(fieldName, objectOrReference)`. <br/>
|
3093 | [@benjamn](https://github.com/benjamn) in [#5651](https://github.com/apollographql/apollo-client/pull/5651)
|
3094 |
|
3095 | - Expose cache `modify` and `identify` to the mutate `update` function. <br/>
|
3096 | [@hwillson](https://github.com/hwillson) in [#5956](https://github.com/apollographql/apollo-client/pull/5956)
|
3097 |
|
3098 | - Add a default `gc` implementation to `ApolloCache`. <br/>
|
3099 | [@justinwaite](https://github.com/justinwaite) in [#5974](https://github.com/apollographql/apollo-client/pull/5974)
|
3100 |
|
3101 | ### React
|
3102 |
|
3103 | - **[BREAKING]** The `QueryOptions`, `MutationOptions`, and `SubscriptionOptions` React Apollo interfaces have been renamed to `QueryDataOptions`, `MutationDataOptions`, and `SubscriptionDataOptions` (to avoid conflicting with similarly named and exported Apollo Client interfaces).
|
3104 |
|
3105 | - **[BREAKING]** Results with `loading: true` will no longer redeliver previous data, though they may provide partial data from the cache, when available. <br/>
|
3106 | [@benjamn](https://github.com/benjamn) in [#6566](https://github.com/apollographql/apollo-client/pull/6566)
|
3107 |
|
3108 | - **[BREAKING?]** Remove `fixPolyfills.ts`, except when bundling for React Native. If you have trouble with `Map` or `Set` operations due to frozen key objects in React Native, either update React Native to version 0.59.0 (or 0.61.x, if possible) or investigate why `fixPolyfills.native.js` is not included in your bundle. <br/>
|
3109 | [@benjamn](https://github.com/benjamn) in [#5962](https://github.com/apollographql/apollo-client/pull/5962)
|
3110 |
|
3111 | - The contents of the `@apollo/react-hooks` package have been merged into `@apollo/client`, enabling the following all-in-one `import`:
|
3112 |
|
3113 | ```ts
|
3114 | import { ApolloClient, ApolloProvider, useQuery } from "@apollo/client";
|
3115 | ```
|
3116 |
|
3117 | [@hwillson](https://github.com/hwillson) in [#5357](https://github.com/apollographql/apollo-client/pull/5357)
|
3118 |
|
3119 | - React SSR features (previously accessed via `@apollo/react-ssr`) can now be accessed from the separate Apollo Client entry point of `@apollo/client/react/ssr`. These features are not included in the default `@apollo/client` bundle. <br/>
|
3120 | [@hwillson](https://github.com/hwillson) in [#6499](https://github.com/apollographql/apollo-client/pull/6499)
|
3121 |
|
3122 | ### General
|
3123 |
|
3124 | - **[BREAKING]** Removed `graphql-anywhere` since it's no longer used by Apollo Client. <br/>
|
3125 | [@hwillson](https://github.com/hwillson) in [#5159](https://github.com/apollographql/apollo-client/pull/5159)
|
3126 |
|
3127 | - **[BREAKING]** Removed `apollo-boost` since Apollo Client 3.0 provides a boost like getting started experience out of the box. <br/>
|
3128 | [@hwillson](https://github.com/hwillson) in [#5217](https://github.com/apollographql/apollo-client/pull/5217)
|
3129 |
|
3130 | - **[BREAKING]** We are no longer exporting certain (intended to be) internal utilities. If you are depending on some of the lesser known exports from `apollo-cache`, `apollo-cache-inmemory`, or `apollo-utilities`, they may no longer be available from `@apollo/client`. <br/>
|
3131 | [@hwillson](https://github.com/hwillson) in [#5437](https://github.com/apollographql/apollo-client/pull/5437) and [#5514](https://github.com/apollographql/apollo-client/pull/5514)
|
3132 |
|
3133 | > Utilities that were previously externally available through the `apollo-utilities` package are now only available by importing from `@apollo/client/utilities`. <br/> > [@hwillson](https://github.com/hwillson) in [#5683](https://github.com/apollographql/apollo-client/pull/5683)
|
3134 |
|
3135 | - Make sure all `graphql-tag` public exports are re-exported. <br/>
|
3136 | [@hwillson](https://github.com/hwillson) in [#5861](https://github.com/apollographql/apollo-client/pull/5861)
|
3137 |
|
3138 | - Fully removed `prettier`. The Apollo Client team has decided to no longer automatically enforce code formatting across the codebase. In most cases existing code styles should be followed as much as possible, but this is not a hard and fast rule. <br/>
|
3139 | [@hwillson](https://github.com/hwillson) in [#5227](https://github.com/apollographql/apollo-client/pull/5227)
|
3140 |
|
3141 | - Make sure `ApolloContext` plays nicely with IE11 when storing the shared context. <br/>
|
3142 | [@ms](https://github.com/ms) in [#5840](https://github.com/apollographql/apollo-client/pull/5840)
|
3143 |
|
3144 | - Migrated React Apollo HOC and Components functionality into Apollo Client, making it accessible from `@apollo/client/react/components` and `@apollo/client/react/hoc` entry points. <br/>
|
3145 | [@hwillson](https://github.com/hwillson) in [#6558](https://github.com/apollographql/apollo-client/pull/6558)
|
3146 |
|
3147 | - Support passing a `context` object through the link execution chain when using subscriptions. <br/>
|
3148 | [@sgtpepper43](https://github.com/sgtpepper43) in [#4925](https://github.com/apollographql/apollo-client/pull/4925)
|
3149 |
|
3150 | - `MockSubscriptionLink` now supports multiple subscriptions. <br/>
|
3151 | [@dfrankland](https://github.com/dfrankland) in [#6081](https://github.com/apollographql/apollo-client/pull/6081)
|
3152 |
|
3153 | ### Bug Fixes
|
3154 |
|
3155 | - `useMutation` adjustments to help avoid an infinite loop / too many renders issue, caused by unintentionally modifying the `useState` based mutation result directly. <br/>
|
3156 | [@hwillson](https://github/com/hwillson) in [#5770](https://github.com/apollographql/apollo-client/pull/5770)
|
3157 |
|
3158 | - Missing `__typename` fields no longer cause the `InMemoryCache#diff` result to be marked `complete: false`, if those fields were added by `InMemoryCache#transformDocument` (which calls `addTypenameToDocument`). <br/>
|
3159 | [@benjamn](https://github.com/benjamn) in [#5787](https://github.com/apollographql/apollo-client/pull/5787)
|
3160 |
|
3161 | - Fixed an issue that allowed `@client @export` based queries to lead to extra unnecessary network requests being fired. <br/>
|
3162 | [@hwillson](https://github.com/hwillson) in [#5946](https://github.com/apollographql/apollo-client/pull/5946)
|
3163 |
|
3164 | - Refined `useLazyQuery` types to help prevent runtime errors. <br/>
|
3165 | [@benmosher](https://github.com/benmosher) in [#5935](https://github.com/apollographql/apollo-client/pull/5935)
|
3166 |
|
3167 | - Make sure `@client @export` variables used in watched queries are updated each time the query receives new data that changes the value of the `@export` variable. <br/>
|
3168 | [@hwillson](https://github.com/hwillson) in [#5986](https://github.com/apollographql/apollo-client/pull/5986)
|
3169 |
|
3170 | - Ensure `useMutation` passes a defined `errorPolicy` option into its underlying `ApolloClient.mutate()` call. <br/>
|
3171 | [@jamesreggio](https://github.com/jamesreggio) in [#5863](https://github.com/apollographql/apollo-client/pull/5863)
|
3172 |
|
3173 | - `useQuery`: Prevent new data re-render attempts during an existing render. This helps avoid React 16.13.0's "Cannot update a component from inside the function body of a different component" warning (https://github.com/facebook/react/pull/17099). <br/>
|
3174 | [@hwillson](https://github.com/hwillson) in [#6107](https://github.com/apollographql/apollo-client/pull/6107)
|
3175 |
|
3176 | - Expand `ApolloError` typings to include `ServerError` and `ServerParseError`. <br/>
|
3177 | [@dmarkow](https://github.com/dmarkow) in [#6319](https://github.com/apollographql/apollo-client/pull/6319)
|
3178 |
|
3179 | - Fast responses received over the link chain will no longer conflict with `skip` settings. <br/>
|
3180 | [@hwillson](https://github.com/hwillson) in [#6587](https://github.com/apollographql/apollo-client/pull/6587)
|
3181 |
|
3182 | ## Apollo Client 2.6.8
|
3183 |
|
3184 | ### Apollo Client (2.6.8)
|
3185 |
|
3186 | - Update the `fetchMore` type signature to accept `context`. <br/>
|
3187 | [@koenpunt](https://github.com/koenpunt) in [#5147](https://github.com/apollographql/apollo-client/pull/5147)
|
3188 |
|
3189 | - Fix type for `Resolver` and use it in the definition of `Resolvers`. <br />
|
3190 | [@peoplenarthax](https://github.com/peoplenarthax) in [#4943](https://github.com/apollographql/apollo-client/pull/4943)
|
3191 |
|
3192 | - Local state resolver functions now receive a `fragmentMap: FragmentMap`
|
3193 | object, in addition to the `field: FieldNode` object, via the `info`
|
3194 | parameter. <br/>
|
3195 | [@mjlyons](https://github.com/mjlyons) in [#5388](https://github.com/apollographql/apollo-client/pull/5388)
|
3196 |
|
3197 | - Documentation updates. <br/>
|
3198 | [@tomquirk](https://github.com/tomquirk) in [#5645](https://github.com/apollographql/apollo-client/pull/5645) <br/>
|
3199 | [@Sequoia](https://github.com/Sequoia) in [#5641](https://github.com/apollographql/apollo-client/pull/5641) <br/>
|
3200 | [@phryneas](https://github.com/phryneas) in [#5628](https://github.com/apollographql/apollo-client/pull/5628) <br/>
|
3201 | [@AryanJ-NYC](https://github.com/AryanJ-NYC) in [#5560](https://github.com/apollographql/apollo-client/pull/5560)
|
3202 |
|
3203 | ### GraphQL Anywhere (4.2.6)
|
3204 |
|
3205 | - Fix `filter` edge case involving `null`. <br/>
|
3206 | [@lifeiscontent](https://github.com/lifeiscontent) in [#5110](https://github.com/apollographql/apollo-client/pull/5110)
|
3207 |
|
3208 | ### Apollo Boost (0.4.7)
|
3209 |
|
3210 | - Replace `GlobalFetch` reference with `WindowOrWorkerGlobalScope`. <br/>
|
3211 | [@abdonrd](https://github.com/abdonrd) in [#5373](https://github.com/apollographql/apollo-client/pull/5373)
|
3212 |
|
3213 | - Add `assumeImmutableResults` typing to apollo boost `PresetConfig` interface. <br/>
|
3214 | [@bencoullie](https://github.com/bencoullie) in [#5571](https://github.com/apollographql/apollo-client/pull/5571)
|
3215 |
|
3216 | ## Apollo Client (2.6.4)
|
3217 |
|
3218 | ### Apollo Client (2.6.4)
|
3219 |
|
3220 | - Modify `ObservableQuery` to allow queries with `notifyOnNetworkStatusChange`
|
3221 | to be notified when loading after an error occurs. <br />
|
3222 | [@jasonpaulos](https://github.com/jasonpaulos) in [#4992](https://github.com/apollographql/apollo-client/pull/4992)
|
3223 |
|
3224 | - Add `graphql` as a `peerDependency` of `apollo-cache` and
|
3225 | `graphql-anywhere`. <br/>
|
3226 | [@ssalbdivad](https://github.com/ssalbdivad) in [#5081](https://github.com/apollographql/apollo-client/pull/5081)
|
3227 |
|
3228 | - Documentation updates. </br>
|
3229 | [@raibima](https://github.com/raibima) in [#5132](https://github.com/apollographql/apollo-client/pull/5132) <br/>
|
3230 | [@hwillson](https://github.com/hwillson) in [#5141](https://github.com/apollographql/apollo-client/pull/5141)
|
3231 |
|
3232 | ## Apollo Client (2.6.3)
|
3233 |
|
3234 | ### Apollo Client (2.6.3)
|
3235 |
|
3236 | - A new `ObservableQuery.resetQueryStoreErrors()` method is now available that
|
3237 | can be used to clear out `ObservableQuery` query store errors. <br/>
|
3238 | [@hwillson](https://github.com/hwillson) in [#4941](https://github.com/apollographql/apollo-client/pull/4941)
|
3239 | - Documentation updates. <br/>
|
3240 | [@michael-watson](https://github.com/michael-watson) in [#4940](https://github.com/apollographql/apollo-client/pull/4940) <br/>
|
3241 | [@hwillson](https://github.com/hwillson) in [#4969](https://github.com/apollographql/apollo-client/pull/4969)
|
3242 |
|
3243 | ## Apollo Client (2.6.1)
|
3244 |
|
3245 | ### Apollo Utilities 1.3.2
|
3246 |
|
3247 | - Reimplement `isEqual` without pulling in massive `lodash.isequal`. <br/>
|
3248 | [@benjamn](https://github.com/benjamn) in [#4924](https://github.com/apollographql/apollo-client/pull/4924)
|
3249 |
|
3250 | ## Apollo Client (2.6.1)
|
3251 |
|
3252 | - In all Apollo Client packages, the compilation of `lib/bundle.esm.js` to `lib/bundle.cjs.js` and `lib/bundle.umd.js` now uses Babel instead of Rollup, since Babel correctly compiles some [edge cases](https://github.com/apollographql/apollo-client/issues/4843#issuecomment-495717720) that neither Rollup nor TypeScript compile correctly. <br/>
|
3253 | [@benjamn](https://github.com/benjamn) in [#4911](https://github.com/apollographql/apollo-client/pull/4911)
|
3254 |
|
3255 | ### Apollo Cache In-Memory 1.6.1
|
3256 |
|
3257 | - Pretend that `__typename` exists on the root Query when matching fragments. <br/>
|
3258 | [@benjamn](https://github.com/benjamn) in [#4853](https://github.com/apollographql/apollo-client/pull/4853)
|
3259 |
|
3260 | ### Apollo Utilities 1.3.1
|
3261 |
|
3262 | - The `isEqual` function has been reimplemented using the `lodash.isequal` npm package, to better support circular references. Since the `lodash.isequal` package is already used by `react-apollo`, this change is likely to decrease total bundle size. <br/>
|
3263 | [@capaj](https://github.com/capaj) in [#4915](https://github.com/apollographql/apollo-client/pull/4915)
|
3264 |
|
3265 | ## Apollo Client (2.6.0)
|
3266 |
|
3267 | - In production, `invariant(condition, message)` failures will now include
|
3268 | a unique error code that can be used to trace the error back to the
|
3269 | point of failure. <br/>
|
3270 | [@benjamn](https://github.com/benjamn) in [#4521](https://github.com/apollographql/apollo-client/pull/4521)
|
3271 |
|
3272 | ### Apollo Client 2.6.0
|
3273 |
|
3274 | - If you can be sure your application code does not modify cache result objects (see `freezeResults` note below), you can unlock substantial performance improvements by communicating this assumption via
|
3275 |
|
3276 | ```ts
|
3277 | new ApolloClient({ assumeImmutableResults: true });
|
3278 | ```
|
3279 |
|
3280 | which allows the client to avoid taking defensive snapshots of past results using `cloneDeep`, as explained by [@benjamn](https://github.com/benjamn) in [#4543](https://github.com/apollographql/apollo-client/pull/4543).
|
3281 |
|
3282 | - Identical overlapping queries are now deduplicated internally by `apollo-client`, rather than using the `apollo-link-dedup` package. <br/>
|
3283 | [@benjamn](https://github.com/benjamn) in commit [7cd8479f](https://github.com/apollographql/apollo-client/pull/4586/commits/7cd8479f27ce38930f122e4f703c4081a75a63a7)
|
3284 |
|
3285 | - The `FetchPolicy` type has been split into two types, so that passing `cache-and-network` to `ApolloClient#query` is now forbidden at the type level, whereas previously it was forbidden by a runtime `invariant` assertion:
|
3286 |
|
3287 | ```ts
|
3288 | export type FetchPolicy =
|
3289 | | "cache-first"
|
3290 | | "network-only"
|
3291 | | "cache-only"
|
3292 | | "no-cache"
|
3293 | | "standby";
|
3294 |
|
3295 | export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network";
|
3296 | ```
|
3297 |
|
3298 | The exception thrown if you ignore the type error has also been improved to explain the motivation behind this restriction. <br/>
|
3299 | [Issue #3130 (comment)](https://github.com/apollographql/apollo-client/issues/3130#issuecomment-478409066) and commit [cf069bc7](github.com/apollographql/apollo-client/commit/cf069bc7ee6577092234b0eb0ac32e05d50f5a1c)
|
3300 |
|
3301 | - Avoid updating (and later invalidating) cache watches when `fetchPolicy` is `'no-cache'`. <br/>
|
3302 | [@bradleyayers](https://github.com/bradleyayers) in [PR #4573](https://github.com/apollographql/apollo-client/pull/4573), part of [issue #3452](https://github.com/apollographql/apollo-client/issues/3452)
|
3303 |
|
3304 | - Remove temporary `queryId` after `fetchMore` completes. <br/>
|
3305 | [@doomsower](https://github.com/doomsower) in [#4440](https://github.com/apollographql/apollo-client/pull/4440)
|
3306 |
|
3307 | - Call `clearStore` callbacks after clearing store. <br/>
|
3308 | [@ds8k](https://github.com/ds8k) in [#4695](https://github.com/apollographql/apollo-client/pull/4695)
|
3309 |
|
3310 | - Perform all `DocumentNode` transforms once, and cache the results. <br/>
|
3311 | [@benjamn](https://github.com/benjamn) in [#4601](https://github.com/apollographql/apollo-client/pull/4601)
|
3312 |
|
3313 | - Accommodate `@client @export` variable changes in `ObservableQuery`. <br/>
|
3314 | [@hwillson](https://github.com/hwillson) in [#4604](https://github.com/apollographql/apollo-client/pull/4604)
|
3315 |
|
3316 | - Support the `returnPartialData` option for watched queries again. <br/>
|
3317 | [@benjamn](https://github.com/benjamn) in [#4743](https://github.com/apollographql/apollo-client/pull/4743)
|
3318 |
|
3319 | - Preserve `networkStatus` for incomplete `cache-and-network` queries. <br/>
|
3320 | [@benjamn](https://github.com/benjamn) in [#4765](https://github.com/apollographql/apollo-client/pull/4765)
|
3321 |
|
3322 | - Preserve `cache-and-network` `fetchPolicy` when refetching. <br/>
|
3323 | [@benjamn](https://github.com/benjamn) in [#4840](https://github.com/apollographql/apollo-client/pull/4840)
|
3324 |
|
3325 | - Update the React Native docs to remove the request for external example apps that we can link to. We're no longer going to manage a list of external example apps. <br />
|
3326 | [@hwillson](https://github.com/hwillson) in [#4531](https://github.com/apollographql/apollo-client/pull/4531)
|
3327 |
|
3328 | - Polling queries are no longer batched together, so their scheduling should be more predictable. <br/>
|
3329 | [@benjamn](https://github.com/benjamn) in [#4800](https://github.com/apollographql/apollo-client/pull/4800)
|
3330 |
|
3331 | ### Apollo Cache In-Memory 1.6.0
|
3332 |
|
3333 | - Support `new InMemoryCache({ freezeResults: true })` to help enforce immutability. <br/>
|
3334 | [@benjamn](https://github.com/benjamn) in [#4514](https://github.com/apollographql/apollo-client/pull/4514)
|
3335 |
|
3336 | - Allow `IntrospectionFragmentMatcher` to match fragments against the root `Query`, as `HeuristicFragmentMatcher` does. <br/>
|
3337 | [@rynobax](https://github.com/rynobax) in [#4620](https://github.com/apollographql/apollo-client/pull/4620)
|
3338 |
|
3339 | - Rerential identity (`===`) of arrays in cache results will now be preserved for unchanged data. <br/>
|
3340 | [@benjamn](https://github.com/benjamn) in commit [f3091d6a](https://github.com/apollographql/apollo-client/pull/4586/commits/f3091d6a7e91be98549baea58903282cc540f460)
|
3341 |
|
3342 | - Avoid adding `__typename` field to `@client` selection sets that have been `@export`ed as input variables. <br/>
|
3343 | [@benjamn](https://github.com/benjamn) in [#4784](https://github.com/apollographql/apollo-client/pull/4784)
|
3344 |
|
3345 | ### GraphQL Anywhere 4.2.2
|
3346 |
|
3347 | - The `graphql` function can now be configured to ignore `@include` and
|
3348 | `@skip` directives (useful when walking a fragment to generate prop types
|
3349 | or filter result data). <br/>
|
3350 | [@GreenGremlin](https://github.com/GreenGremlin) in [#4373](https://github.com/apollographql/apollo-client/pull/4373)
|
3351 |
|
3352 | ## Apollo Client 2.5.1
|
3353 |
|
3354 | ### apollo-client 2.5.1
|
3355 |
|
3356 | - Fixes `A tuple type element list cannot be empty` issue. <br/>
|
3357 | [@benjamn](https://github.com/benjamn) in [#4502](https://github.com/apollographql/apollo-client/pull/4502)
|
3358 |
|
3359 | ### graphql-anywhere 4.2.1
|
3360 |
|
3361 | - Adds back the missing `graphql-anywhere/lib/async` entry point. <br/>
|
3362 | [@benjamn](https://github.com/benjamn) in [#4503](https://github.com/apollographql/apollo-client/pull/4503)
|
3363 |
|
3364 | ## Apollo Client (2.5.0)
|
3365 |
|
3366 | ### Apollo Client (2.5.0)
|
3367 |
|
3368 | - Introduces new local state management features (client-side schema
|
3369 | and local resolver / `@client` support) and many overall code improvements,
|
3370 | to help reduce the Apollo Client bundle size. <br/>
|
3371 | [#4361](https://github.com/apollographql/apollo-client/pull/4361)
|
3372 | - Revamped CJS and ESM bundling approach with Rollup. <br/>
|
3373 | [@rosskevin](https://github.com/rosskevin) in [#4261](https://github.com/apollographql/apollo-client/pull/4261)
|
3374 | - Fixes an issue where the `QueryManager` was accidentally returning cached
|
3375 | data for `network-only` queries. <br/>
|
3376 | [@danilobuerger](https://github.com/danilobuerger) in [#4352](https://github.com/apollographql/apollo-client/pull/4352)
|
3377 | - Fixed an issue in the repo `.gitattributes` that was causing binary files
|
3378 | to have their line endings adjusted, and cleaned up corrupted documentation
|
3379 | images (ref: https://github.com/apollographql/apollo-client/pull/4232). <br/>
|
3380 | [@rajington](https://github.com/rajington) in [#4438](https://github.com/apollographql/apollo-client/pull/4438)
|
3381 | - Improve (and shorten) query polling implementation. <br/>
|
3382 | [PR #4337](https://github.com/apollographql/apollo-client/pull/4337)
|
3383 |
|
3384 | ## Apollo Client (2.4.13)
|
3385 |
|
3386 | ### Apollo Client (2.4.13)
|
3387 |
|
3388 | - Resolve "invalidate" -> "invalidated" typo in `QueryManager`. <br/>
|
3389 | [@quazzie](https://github.com/quazzie) in [#4041](https://github.com/apollographql/apollo-client/pull/4041)
|
3390 |
|
3391 | - Properly type `setQuery` and fix now typed callers. <br/>
|
3392 | [@danilobuerger](https://github.com/danilobuerger) in [#4369](https://github.com/apollographql/apollo-client/pull/4369)
|
3393 |
|
3394 | - Align with the React Apollo decision that result `data` should be
|
3395 | `TData | undefined` instead of `TData | {}`. <br/>
|
3396 | [@danilobuerger](https://github.com/danilobuerger) in [#4356](https://github.com/apollographql/apollo-client/pull/4356)
|
3397 |
|
3398 | - Documentation updates. <br/>
|
3399 | [@danilobuerger](https://github.com/danilobuerger) in [#4340](https://github.com/apollographql/apollo-client/pull/4340) <br />
|
3400 | [@justyn-clark](https://github.com/justyn-clark) in [#4383](https://github.com/apollographql/apollo-client/pull/4383) <br />
|
3401 | [@jtassin](https://github.com/jtassin) in [#4287](https://github.com/apollographql/apollo-client/pull/4287) <br />
|
3402 | [@Gongreg](https://github.com/Gongreg) in [#4386](https://github.com/apollographql/apollo-client/pull/4386) <br />
|
3403 | [@davecardwell](https://github.com/davecardwell) in [#4399](https://github.com/apollographql/apollo-client/pull/4399) <br />
|
3404 | [@michaelknoch](https://github.com/michaelknoch) in [#4384](https://github.com/apollographql/apollo-client/pull/4384) <br />
|
3405 |
|
3406 | ## Apollo Client (2.4.12)
|
3407 |
|
3408 | ### Apollo Client (2.4.12)
|
3409 |
|
3410 | - Support `ApolloClient#stop` method for safe client disposal. <br/>
|
3411 | [PR #4336](https://github.com/apollographql/apollo-client/pull/4336)
|
3412 |
|
3413 | ## Apollo Client (2.4.11)
|
3414 |
|
3415 | - Added explicit dependencies on the
|
3416 | [`tslib`](https://www.npmjs.com/package/tslib) package to all client
|
3417 | packages to fix
|
3418 | [Issue #4332](https://github.com/apollographql/apollo-client/issues/4332).
|
3419 |
|
3420 | ### Apollo Client (2.4.11)
|
3421 |
|
3422 | - Reverted some breaking changes accidentally released in a patch version
|
3423 | (2.4.10). [PR #4334](https://github.com/apollographql/apollo-client/pull/4334)
|
3424 |
|
3425 | ## Apollo Client (2.4.10)
|
3426 |
|
3427 | ### Apollo Client (2.4.10)
|
3428 |
|
3429 | - The `apollo-client` package no longer exports a `printAST` function from
|
3430 | `graphql/language/printer`. If you need this functionality, import it
|
3431 | directly: `import { print } from "graphql/language/printer"`
|
3432 |
|
3433 | - Query polling now uses a simpler scheduling strategy based on a single
|
3434 | `setTimeout` interval rather than multiple `setInterval` timers. The new
|
3435 | timer fires at the rate of the fastest polling interval, and queries
|
3436 | with longer polling intervals fire whenever the time elapsed since they
|
3437 | last fired exceeds their desired interval. <br/>
|
3438 | [PR #4243](https://github.com/apollographql/apollo-client/pull/4243)
|
3439 |
|
3440 | ### Apollo Cache In-Memory (1.4.1)
|
3441 |
|
3442 | - The `optimism` npm package has been updated to a version (0.6.9) that
|
3443 | provides its own TypeScript declarations, which should fix problems like
|
3444 | [Issue #4327](https://github.com/apollographql/apollo-client/issues/4327). <br/>
|
3445 | [PR #4331](https://github.com/apollographql/apollo-client/pull/4331)
|
3446 |
|
3447 | - Error messages involving GraphQL queries now print the queries using
|
3448 | `JSON.stringify` instead of the `print` function exported by the
|
3449 | `graphql` package, to avoid pulling unnecessary printing logic into your
|
3450 | JavaScript bundle. <br/>
|
3451 | [PR #4234](https://github.com/apollographql/apollo-client/pull/4234)
|
3452 |
|
3453 | - The `QueryKeyMaker` abstraction has been removed, meaning that cache
|
3454 | results for non-identical queries (or sub-queries) with equivalent
|
3455 | structure will no longer be cached together. This feature was a nice
|
3456 | optimization in certain specific use cases, but it was not worth the
|
3457 | additional complexity or bundle size. <br/>
|
3458 | [PR #4245](https://github.com/apollographql/apollo-client/pull/4245)
|
3459 |
|
3460 | ### Apollo Utilities (1.1.1)
|
3461 |
|
3462 | - The `flattenSelections` helper function is no longer exported from
|
3463 | `apollo-utilities`, since `getDirectiveNames` has been reimplemented
|
3464 | without using `flattenSelections`, and `flattenSelections` has no clear
|
3465 | purpose now. If you need the old functionality, use a visitor:
|
3466 |
|
3467 | ```ts
|
3468 | import { visit } from "graphql/language/visitor";
|
3469 |
|
3470 | function flattenSelections(selection: SelectionNode) {
|
3471 | const selections: SelectionNode[] = [];
|
3472 | visit(selection, {
|
3473 | SelectionSet(ss) {
|
3474 | selections.push(...ss.selections);
|
3475 | },
|
3476 | });
|
3477 | return selections;
|
3478 | }
|
3479 | ```
|
3480 |
|
3481 | ## Apollo Client (2.4.9)
|
3482 |
|
3483 | ### Apollo Client (2.4.9)
|
3484 |
|
3485 | - Apollo Client has been updated to use `graphql` 14.x as a dev dependency. <br/>
|
3486 | [@hwillson](https://github.com/hwillson) in [#4233](https://github.com/apollographql/apollo-client/pull/4233)
|
3487 |
|
3488 | - The `onClearStore` function can now be used to register callbacks that should
|
3489 | be triggered when calling `clearStore`. <br/>
|
3490 | [@joe-re](https://github.com/joe-re) in [#4082](https://github.com/apollographql/apollo-client/pull/4082)
|
3491 |
|
3492 | - Make `isApolloError` available for external use. <br/>
|
3493 | [@FredyC](https://github.com/FredyC) in [#4223](https://github.com/apollographql/apollo-client/pull/4223)
|
3494 |
|
3495 | - The `QueryManager` now calls `complete` on the observables used by
|
3496 | Apollo Client's Subscription handling. This gives finite subscriptions a
|
3497 | chance to handle cleanup. <br/>
|
3498 | [@sujeetsr](https://github.com/sujeetsr) in [#4290](https://github.com/apollographql/apollo-client/pull/4290)
|
3499 |
|
3500 | - Documentation updates. <br/>
|
3501 | [@lifedup](https://github.com/lifedup) in [#3931](https://github.com/apollographql/apollo-client/pull/3931) <br />
|
3502 | [@Dem0n3D](https://github.com/Dem0n3D) in [#4008](https://github.com/apollographql/apollo-client/pull/4008) <br />
|
3503 | [@anand-sundaram-zocdoc](https://github.com/anand-sundaram-zocdoc) in [#4009](https://github.com/apollographql/apollo-client/pull/4009) <br />
|
3504 | [@mattphoto](https://github.com/mattphoto) in [#4026](https://github.com/apollographql/apollo-client/pull/4026) <br />
|
3505 | [@birge](https://github.com/birge) in [#4029](https://github.com/apollographql/apollo-client/pull/4029) <br />
|
3506 | [@mxstbr](https://github.com/mxstbr) in [#4127](https://github.com/apollographql/apollo-client/pull/4127) <br/>
|
3507 | [@Caerbannog](https://github.com/Caerbannog) in [#4140](https://github.com/apollographql/apollo-client/pull/4140) <br/>
|
3508 | [@jedwards1211](https://github.com/jedwards1211) in [#4179](https://github.com/apollographql/apollo-client/pull/4179) <br/>
|
3509 | [@nutboltu](https://github.com/nutboltu) in [#4182](https://github.com/apollographql/apollo-client/pull/4182) <br/>
|
3510 | [@CarloPalinckx](https://github.com/CarloPalinckx) in [#4189](https://github.com/apollographql/apollo-client/pull/4189) <br/>
|
3511 | [@joebernard](https://github.com/joebernard) in [#4206](https://github.com/apollographql/apollo-client/pull/4206) <br/>
|
3512 | [@evans](https://github.com/evans) in [#4213](https://github.com/apollographql/apollo-client/pull/4213) <br/>
|
3513 | [@danilobuerger](https://github.com/danilobuerger) in [#4214](https://github.com/apollographql/apollo-client/pull/4214) <br/>
|
3514 | [@stubailo](https://github.com/stubailo) in [#4220](https://github.com/apollographql/apollo-client/pull/4220) <br/>
|
3515 | [@haysclark](https://github.com/haysclark) in [#4255](https://github.com/apollographql/apollo-client/pull/4255) <br/>
|
3516 | [@shelmire](https://github.com/shelmire) in [#4266](https://github.com/apollographql/apollo-client/pull/4266) <br/>
|
3517 | [@peggyrayzis](https://github.com/peggyrayzis) in [#4280](https://github.com/apollographql/apollo-client/pull/4280) <br/>
|
3518 | [@caydie-tran](https://github.com/caydie-tran) in [#4300](https://github.com/apollographql/apollo-client/pull/4300)
|
3519 |
|
3520 | ### Apollo Utilities (1.1.0)
|
3521 |
|
3522 | - Transformation utilities have been refactored to work with `graphql` 14.x.
|
3523 | GraphQL AST's are no longer being directly modified. <br/>
|
3524 | [@hwillson](https://github.com/hwillson) in [#4233](https://github.com/apollographql/apollo-client/pull/4233)
|
3525 |
|
3526 | ### Apollo Cache In-Memory (1.4.0)
|
3527 |
|
3528 | - The speed and memory usage of optimistic reads and writes has been
|
3529 | improved dramatically using a new layering technique that does not
|
3530 | require copying the non-optimistic contents of the cache. <br/>
|
3531 | [PR #4319](https://github.com/apollographql/apollo-client/pull/4319/)
|
3532 |
|
3533 | - The `RecordingCache` abstraction has been removed, and thus is no longer
|
3534 | exported from `apollo-cache-inmemory`. <br/>
|
3535 | [PR #4319](https://github.com/apollographql/apollo-client/pull/4319/)
|
3536 |
|
3537 | - Export the optimism `wrap` function using ES2015 export syntax, instead of
|
3538 | CommonJS. <br/>
|
3539 | [@ardatan](https://github.com/ardatan) in [#4158](https://github.com/apollographql/apollo-client/pull/4158)
|
3540 |
|
3541 | ## Apollo Client (2.4.8)
|
3542 |
|
3543 | ### Apollo Client (2.4.8)
|
3544 |
|
3545 | - Documentation and config updates. <br/>
|
3546 | [@justinanastos](https://github.com/justinanastos) in [#4187](https://github.com/apollographql/apollo-client/pull/4187) <br/>
|
3547 | [@PowerKiKi](https://github.com/PowerKiKi) in [#3693](https://github.com/apollographql/apollo-client/pull/3693) <br/>
|
3548 | [@nandito](https://github.com/nandito) in [#3865](https://github.com/apollographql/apollo-client/pull/3865)
|
3549 |
|
3550 | - Schema/AST tranformation utilities have been updated to work properly with
|
3551 | `@client` directives. <br/>
|
3552 | [@justinmakaila](https://github.com/justinmakaila) in [#3482](https://github.com/apollographql/apollo-client/pull/3482)
|
3553 |
|
3554 | ### Apollo Cache In-Memory (1.3.12)
|
3555 |
|
3556 | - Avoid using `DepTrackingCache` for optimistic reads.
|
3557 | [PR #4521](https://github.com/apollographql/apollo-client/pull/4251)
|
3558 |
|
3559 | - When creating an `InMemoryCache` object, it's now possible to disable the
|
3560 | result caching behavior introduced in [#3394](https://github.com/apollographql/apollo-client/pull/3394),
|
3561 | either for diagnostic purposes or because the benefit of caching repeated
|
3562 | reads is not worth the extra memory usage in your application:
|
3563 | ```ts
|
3564 | new InMemoryCache({
|
3565 | resultCaching: false,
|
3566 | });
|
3567 | ```
|
3568 | Part of [PR #4521](https://github.com/apollographql/apollo-client/pull/4251).
|
3569 |
|
3570 | ## Apollo Client (2.4.7)
|
3571 |
|
3572 | ### Apollo Client (2.4.7)
|
3573 |
|
3574 | - The `ApolloClient` constructor has been updated to accept `name` and
|
3575 | `version` params, that can be used to support Apollo Server [Client Awareness](https://www.apollographql.com/docs/apollo-server/v2/features/metrics.html#Client-Awareness)
|
3576 | functionality. These client awareness properties are passed into the
|
3577 | defined Apollo Link chain, and are then ultimately sent out as custom
|
3578 | headers with outgoing requests. <br/>
|
3579 | [@hwillson](https://github.com/hwillson) in [#4154](https://github.com/apollographql/apollo-client/pull/4154)
|
3580 |
|
3581 | ### Apollo Boost (0.1.22)
|
3582 |
|
3583 | - No changes.
|
3584 |
|
3585 | ### Apollo Cache (1.1.21)
|
3586 |
|
3587 | - No changes.
|
3588 |
|
3589 | ### Apollo Cache In-Memory (1.3.11)
|
3590 |
|
3591 | - No changes.
|
3592 |
|
3593 | ### Apollo Utilities (1.0.26)
|
3594 |
|
3595 | - No changes.
|
3596 |
|
3597 | ### Graphql Anywhere (4.1.23)
|
3598 |
|
3599 | - No changes.
|
3600 |
|
3601 | ## Apollo Client (2.4.6)
|
3602 |
|
3603 | ### Apollo Cache In-Memory (1.3.10)
|
3604 |
|
3605 | - Added some `return`s to prevent errors with `noImplicitReturns`
|
3606 | TypeScript rule.
|
3607 | [PR #4137](https://github.com/apollographql/apollo-client/pull/4137)
|
3608 |
|
3609 | - Exclude the `src/` directory when publishing `apollo-cache-inmemory`.
|
3610 | [Issue #4083](https://github.com/apollographql/apollo-client/issues/4083)
|
3611 |
|
3612 | ## Apollo Client (2.4.5)
|
3613 |
|
3614 | - Optimistic tests cleanup.
|
3615 | [PR #3834](https://github.com/apollographql/apollo-client/pull/3834) by
|
3616 | [@joshribakoff](https://github.com/joshribakoff)
|
3617 |
|
3618 | - Documentation updates.
|
3619 | [PR #3840](https://github.com/apollographql/apollo-client/pull/3840) by
|
3620 | [@chentsulin](https://github.com/chentsulin) and
|
3621 | [PR #3844](https://github.com/apollographql/apollo-client/pull/3844) by
|
3622 | [@lorensr](https://github.com/lorensr)
|
3623 |
|
3624 | - Implement `ObservableQuery#isDifferentFromLastResult` to fix
|
3625 | [Issue #4054](https://github.com/apollographql/apollo-client/issues/4054) and
|
3626 | [Issue #4031](https://github.com/apollographql/apollo-client/issues/4031).
|
3627 | [PR #4069](https://github.com/apollographql/apollo-client/pull/4069)
|
3628 |
|
3629 | ### Apollo Cache (1.1.20)
|
3630 |
|
3631 | - Add `readQuery` test to make sure options aren't mutated.
|
3632 | [@CarloPalinckx](https://github.com/CarloPalinckx) in
|
3633 | [#3838](https://github.com/apollographql/apollo-client/pull/3838)
|
3634 |
|
3635 | ### Apollo Cache In-Memory (1.3.9)
|
3636 |
|
3637 | - Avoid modifying source objects when merging cache results.
|
3638 | [Issue #4081](https://github.com/apollographql/apollo-client/issues/4081)
|
3639 | [PR #4089](https://github.com/apollographql/apollo-client/pull/4089)
|
3640 |
|
3641 | ### Apollo Utilities (1.0.25)
|
3642 |
|
3643 | - Fix `apollo-utilities` `isEqual` bug due to missing `hasOwnProperty`
|
3644 | check. [PR #4072](https://github.com/apollographql/apollo-client/pull/4072)
|
3645 | by [@samkline](https://github.com/samkline)
|
3646 |
|
3647 | ## Apollo Client (2.4.4)
|
3648 |
|
3649 | ### Apollo Utilities (1.0.24)
|
3650 |
|
3651 | - Discard property accessor functions in `cloneDeep` helper, to fix
|
3652 | [issue #4034](https://github.com/apollographql/apollo-client/issues/4034).
|
3653 |
|
3654 | - Unconditionally remove `cloneDeep` property accessors.
|
3655 | [PR #4039](https://github.com/apollographql/apollo-client/pull/4039)
|
3656 |
|
3657 | - Avoid copying non-enumerable and/or `Symbol` keys in `cloneDeep`.
|
3658 | [PR #4052](https://github.com/apollographql/apollo-client/pull/4052)
|
3659 |
|
3660 | ### Apollo Cache In-Memory (1.3.7)
|
3661 |
|
3662 | - Throw when querying non-scalar objects without a selection set.
|
3663 | [Issue #4025](https://github.com/apollographql/apollo-client/issues/4025)
|
3664 | [PR #4038](https://github.com/apollographql/apollo-client/pull/4038)
|
3665 |
|
3666 | - Work around spec non-compliance of `Map#set` and `Set#add` in IE11.
|
3667 | [Issue #4024](https://github.com/apollographql/apollo-client/issues/4024)
|
3668 | [PR #4012](https://github.com/apollographql/apollo-client/pull/4012)
|
3669 |
|
3670 | ## Apollo Client (2.4.3)
|
3671 |
|
3672 | - Add additional checks to make sure we don't try to set the network status
|
3673 | of queries in the store, when the store doesn't exist. <br/>
|
3674 | [@i6mi6](https://github.com/i6mi6) in [#3914](https://github.com/apollographql/apollo-client/pull/3914)
|
3675 | - Documentation updates. <br/>
|
3676 | [@shanonvl](https://github.com/shanonvl) in [#3925](https://github.com/apollographql/apollo-client/pull/3925) <br/>
|
3677 | [@ojh102](https://github.com/ojh102) in [#3920](https://github.com/apollographql/apollo-client/pull/3920) <br/>
|
3678 | [@Bkucera](https://github.com/Bkucera) in [#3919](https://github.com/apollographql/apollo-client/pull/3919) <br/>
|
3679 | [@j4chou](https://github.com/j4chou) in [#3915](https://github.com/apollographql/apollo-client/pull/3915) <br/>
|
3680 | [@billfienberg](https://github.com/billfienberg) in [#3886](https://github.com/apollographql/apollo-client/pull/3886) <br/>
|
3681 | [@TLadd](https://github.com/TLadd) in [#3884](https://github.com/apollographql/apollo-client/pull/3884)
|
3682 |
|
3683 | - The `ObservableQuery` class now makes a deep clone of `lastResult` when
|
3684 | first received, so that the `isDifferentResult` logic will not be
|
3685 | confused if the result object is modified later.
|
3686 | [Issue #3992](https://github.com/apollographql/apollo-client/issues/3992)
|
3687 | [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/e66027c5341dc7aaf71ee7ffcba1305b9a553525)
|
3688 |
|
3689 | ### Apollo Cache In-Memory (1.3.6)
|
3690 |
|
3691 | - Optimize repeated `apollo-cache-inmemory` reads by caching partial query
|
3692 | results, for substantial performance improvements. As a consequence, watched
|
3693 | queries will not be rebroadcast unless the data have changed.
|
3694 | [PR #3394](https://github.com/apollographql/apollo-client/pull/3394)
|
3695 |
|
3696 | - Include root ID and fragment matcher function in cache keys computed by
|
3697 | `StoreReader#executeStoreQuery` and `executeSelectionSet`, and work
|
3698 | around bugs in the React Native `Map` and `Set` polyfills.
|
3699 | [PR #3964](https://github.com/apollographql/apollo-client/pull/3964)
|
3700 | [React Native PR #21492 (pending)](https://github.com/facebook/react-native/pull/21492)
|
3701 |
|
3702 | - The `apollo-cache-inmemory` package now allows `graphql@^14.0.0` as a
|
3703 | peer dependency.
|
3704 | [Issue #3978](https://github.com/apollographql/apollo-client/issues/3978)
|
3705 |
|
3706 | - The `apollo-cache-inmemory` package now correctly broadcasts changes
|
3707 | even when the new data is `===` to the old data, since the contents of
|
3708 | the data object may have changed.
|
3709 | [Issue #3992](https://github.com/apollographql/apollo-client/issues/3992)
|
3710 | [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/d6a673fbc1444e115e90cc9e4c7fa3fc67bb7e56)
|
3711 |
|
3712 | ### Apollo GraphQL Anywhere (4.1.20)
|
3713 |
|
3714 | - Make `graphql-anywhere` `filter` function generic (typescript). <br/>
|
3715 | [@minznerjosh](https://github.com/minznerjosh) in [#3929](https://github.com/apollographql/apollo-client/pull/3929)
|
3716 |
|
3717 | ### Apollo Utilities (1.0.22)
|
3718 |
|
3719 | - The `fclone` package has been replaced with a custom `cloneDeep`
|
3720 | implementation that is tolerant of cycles, symbol properties, and
|
3721 | non-enumerable properties.
|
3722 | [PR #4032](https://github.com/apollographql/apollo-client/pull/4032/commits/78e2ad89f950da2829f49c7876f968adb2bc1302)
|
3723 |
|
3724 | ### Apollo Boost (0.1.17)
|
3725 |
|
3726 | - Remove duplicate InMemoryCache export for Babel 6 compatibility.
|
3727 | [Issue #3910](https://github.com/apollographql/apollo-client/issues/3910)
|
3728 | [PR #3932](https://github.com/apollographql/apollo-client/pull/3932)
|
3729 |
|
3730 | ### Apollo Cache (1.1.18)
|
3731 |
|
3732 | - No changes.
|
3733 |
|
3734 | ## Apollo Client (2.4.2)
|
3735 |
|
3736 | ### Apollo Client (2.4.2)
|
3737 |
|
3738 | - Apollo Client no longer deep freezes query results.
|
3739 | [@hwillson](https://github.com/hwillson) in [#3883](https://github.com/apollographql/apollo-client/pull/3883)
|
3740 | - A new `clearStore` method has been added, that will remove all data from
|
3741 | the store. Unlike `resetStore`, it will not refetch active queries after
|
3742 | removing store data.
|
3743 | [@hwillson](https://github.com/hwillson) in [#3885](https://github.com/apollographql/apollo-client/pull/3885)
|
3744 |
|
3745 | ### Apollo Utilities (1.0.21)
|
3746 |
|
3747 | - Replace the custom `cloneDeep` implementation with
|
3748 | [`fclone`](https://www.npmjs.com/package/fclone), to avoid crashing when
|
3749 | encountering circular references. <br/>
|
3750 | [@hwillson](https://github.com/hwillson) in [#3881](https://github.com/apollographql/apollo-client/pull/3881)
|
3751 |
|
3752 | ### Apollo Boost (0.1.16)
|
3753 |
|
3754 | - No changes.
|
3755 |
|
3756 | ### Apollo Cache (1.1.17)
|
3757 |
|
3758 | - No changes.
|
3759 |
|
3760 | ### Apollo Cache In-Memory (1.2.10)
|
3761 |
|
3762 | - No changes.
|
3763 |
|
3764 | ### Apollo GraphQL Anywhere (4.1.19)
|
3765 |
|
3766 | - No changes.
|
3767 |
|
3768 | ## 2.4.1 (August 26, 2018)
|
3769 |
|
3770 | ### Apollo Client (2.4.1)
|
3771 |
|
3772 | - `mutate`'s `refetchQueries` option now allows queries to include a custom
|
3773 | `context` option. This `context` will be used when refetching the query.
|
3774 | For example:
|
3775 |
|
3776 | ```js
|
3777 | context = {
|
3778 | headers: {
|
3779 | token: 'some auth token',
|
3780 | },
|
3781 | };
|
3782 | client.mutate({
|
3783 | mutation: UPDATE_CUSTOMER_MUTATION,
|
3784 | variables: {
|
3785 | userId: user.id,
|
3786 | firstName,
|
3787 | ...
|
3788 | },
|
3789 | refetchQueries: [{
|
3790 | query: CUSTOMER_MESSAGES_QUERY,
|
3791 | variables: { userId: user.id },
|
3792 | context,
|
3793 | }],
|
3794 | context,
|
3795 | });
|
3796 | ```
|
3797 |
|
3798 | The `CUSTOMER_MESSAGES_QUERY` above will be refetched using `context`.
|
3799 | Normally queries are refetched using the original context they were first
|
3800 | started with, but this provides a way to override the context, if needed. <br/>
|
3801 | [@hwillson](https://github.com/hwillson) in [#3852](https://github.com/apollographql/apollo-client/pull/3852)
|
3802 |
|
3803 | - Documentation updates. <br/>
|
3804 | [@hwillson](https://github.com/hwillson) in [#3841](https://github.com/apollographql/apollo-client/pull/3841)
|
3805 |
|
3806 | ### Apollo Boost (0.1.15)
|
3807 |
|
3808 | - Various internal infrastructure changes related to building, bundling,
|
3809 | testing, etc.
|
3810 | [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817)
|
3811 |
|
3812 | ### Apollo Cache (1.1.16)
|
3813 |
|
3814 | - Various internal infrastructure changes related to building, bundling,
|
3815 | testing, etc.
|
3816 | [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817)
|
3817 |
|
3818 | ### Apollo Cache In-Memory (1.2.9)
|
3819 |
|
3820 | - Various internal infrastructure changes related to building, bundling,
|
3821 | testing, etc.
|
3822 | [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817)
|
3823 |
|
3824 | ### Apollo Utilities (1.0.20)
|
3825 |
|
3826 | - Various internal infrastructure changes related to building, bundling,
|
3827 | testing, etc.
|
3828 | [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817)
|
3829 |
|
3830 | ### Apollo GraphQL Anywhere (4.1.18)
|
3831 |
|
3832 | - Various internal infrastructure changes related to building, bundling,
|
3833 | testing, etc.
|
3834 | [@hwillson](https://github.com/hwillson) in [#3817](https://github.com/apollographql/apollo-client/pull/3817)
|
3835 |
|
3836 | ## 2.4.0 (August 17, 2018)
|
3837 |
|
3838 | ### Apollo Client (2.4.0)
|
3839 |
|
3840 | - Add proper error handling for subscriptions. If you have defined an `error`
|
3841 | handler on your subscription observer, it will now be called when an error
|
3842 | comes back in a result, and the `next` handler will be skipped (similar to
|
3843 | how we're handling errors with mutations). Previously, the error was
|
3844 | just passed in the result to the `next` handler. If you don't have an
|
3845 | `error` handler defined, the previous functionality is maintained, meaning
|
3846 | the error is passed in the result, giving the next handler a chance to deal
|
3847 | with it. This should help address backwards compatibility (and is the reason
|
3848 | for the minor version bumo in this release). <br/>
|
3849 | [@clayne11](https://github.com/clayne11) in [#3800](https://github.com/apollographql/apollo-client/pull/3800)
|
3850 | - Allow an `optimistic` param to be passed into `ApolloClient.readQuery` and
|
3851 | `ApolloClient.readFragment`, that when set to `true`, will allow
|
3852 | optimistic results to be returned. Is `false` by default. <br/>
|
3853 | [@jay1337](https://github.com/jay1337) in [#2429](https://github.com/apollographql/apollo-client/pull/2429)
|
3854 | - Optimistic tests cleanup. <br/>
|
3855 | [@joshribakoff](https://github.com/joshribakoff) in [#3713](https://github.com/apollographql/apollo-client/pull/3713)
|
3856 | - Make sure each package has its own `.npmignore`, so they're taken into
|
3857 | consideration when publishing via lerna. <br/>
|
3858 | [@hwillson](https://github.com/hwillson) in [#3828](https://github.com/apollographql/apollo-client/pull/3828)
|
3859 | - Documentation updates. <br/>
|
3860 | [@toolness](https://github.com/toolness) in [#3804](https://github.com/apollographql/apollo-client/pull/3804) <br/>
|
3861 | [@pungggi](https://github.com/pungggi) in [#3798](https://github.com/apollographql/apollo-client/pull/3798) <br/>
|
3862 | [@lorensr](https://github.com/lorensr) in [#3748](https://github.com/apollographql/apollo-client/pull/3748) <br/>
|
3863 | [@joshribakoff](https://github.com/joshribakoff) in [#3730](https://github.com/apollographql/apollo-client/pull/3730) <br/>
|
3864 | [@yalamber](https://github.com/yalamber) in [#3819](https://github.com/apollographql/apollo-client/pull/3819) <br/>
|
3865 | [@pschreibs85](https://github.com/pschreibs85) in [#3812](https://github.com/apollographql/apollo-client/pull/3812) <br/>
|
3866 | [@msreekm](https://github.com/msreekm) in [#3808](https://github.com/apollographql/apollo-client/pull/3808) <br/>
|
3867 | [@kamaltmo](https://github.com/kamaltmo) in [#3806](https://github.com/apollographql/apollo-client/pull/3806) <br/>
|
3868 | [@lorensr](https://github.com/lorensr) in [#3739](https://github.com/apollographql/apollo-client/pull/3739) <br/>
|
3869 | [@brainkim](https://github.com/brainkim) in [#3680](https://github.com/apollographql/apollo-client/pull/3680)
|
3870 |
|
3871 | ### Apollo Cache In-Memory (1.2.8)
|
3872 |
|
3873 | - Fix typo in `console.warn` regarding fragment matching error message. <br/>
|
3874 | [@combizs](https://github.com/combizs) in [#3701](https://github.com/apollographql/apollo-client/pull/3701)
|
3875 |
|
3876 | ### Apollo Boost (0.1.14)
|
3877 |
|
3878 | - No changes.
|
3879 |
|
3880 | ### Apollo Cache (1.1.15)
|
3881 |
|
3882 | - No changes.
|
3883 |
|
3884 | ### Apollo Utilities (1.0.19)
|
3885 |
|
3886 | - No changes.
|
3887 |
|
3888 | ### Apollo GraphQL Anywhere (4.1.17)
|
3889 |
|
3890 | - No changes.
|
3891 |
|
3892 | ## 2.3.8 (August 9, 2018)
|
3893 |
|
3894 | ### Apollo Client (2.3.8)
|
3895 |
|
3896 | - Adjusted the `graphql` peer dependency to cover explicit minor ranges.
|
3897 | Since the ^ operator only covers any minor version if the major version
|
3898 | is not 0 (since a major version of 0 is technically considered development by
|
3899 | semver 2), the current ^0.11.0 || ^14.0.0 graphql range doesn't cover
|
3900 | 0.12._ or 0.13._. This fixes the `apollo-client@X has incorrect peer dependency "graphql@^0.11.0 || ^14.0.0"` errors that people might have
|
3901 | seen using `graphql` 0.12.x or 0.13.x. <br/>
|
3902 | [@hwillson](https://github.com/hwillson) in [#3746](https://github.com/apollographql/apollo-client/pull/3746)
|
3903 | - Document `setVariables` internal API status. <br/>
|
3904 | [@PowerKiKi](https://github.com/PowerKiKi) in [#3692](https://github.com/apollographql/apollo-client/pull/3692)
|
3905 | - Corrected `ApolloClient.queryManager` typing as it may be `undefined`. <br/>
|
3906 | [@danilobuerger](https://github.com/danilobuerger) in [#3661](https://github.com/apollographql/apollo-client/pull/3661)
|
3907 | - Make sure using a `no-cache` fetch policy with subscriptions prevents data
|
3908 | from being cached. <br/>
|
3909 | [@hwillson](https://github.com/hwillson) in [#3773](https://github.com/apollographql/apollo-client/pull/3773)
|
3910 | - Fixed an issue that sometimes caused empty query results, when using the
|
3911 | `no-cache` fetch policy. <br/>
|
3912 | [@hwillson](https://github.com/hwillson) in [#3777](https://github.com/apollographql/apollo-client/pull/3777)
|
3913 | - Documentation updates. <br/>
|
3914 | [@hwillson](https://github.com/hwillson) in [#3750](https://github.com/apollographql/apollo-client/pull/3750) <br/>
|
3915 | [@hwillson](https://github.com/hwillson) in [#3754](https://github.com/apollographql/apollo-client/pull/3754) <br/>
|
3916 | [@TheMightyPenguin](https://github.com/TheMightyPenguin) in [#3725](https://github.com/apollographql/apollo-client/pull/3725) <br/>
|
3917 | [@bennypowers](https://github.com/bennypowers) in [#3668](https://github.com/apollographql/apollo-client/pull/3668) <br/>
|
3918 | [@hwillson](https://github.com/hwillson) in [#3762](https://github.com/apollographql/apollo-client/pull/3762) <br/>
|
3919 | [@chentsulin](https://github.com/chentsulin) in [#3688](https://github.com/apollographql/apollo-client/pull/3688) <br/>
|
3920 | [@chentsulin](https://github.com/chentsulin) in [#3687](https://github.com/apollographql/apollo-client/pull/3687) <br/>
|
3921 | [@ardouglass](https://github.com/ardouglass) in [#3645](https://github.com/apollographql/apollo-client/pull/3645) <br/>
|
3922 | [@hwillson](https://github.com/hwillson) in [#3764](https://github.com/apollographql/apollo-client/pull/3764) <br/>
|
3923 | [@hwillson](https://github.com/hwillson) in [#3767](https://github.com/apollographql/apollo-client/pull/3767) <br/>
|
3924 | [@hwillson](https://github.com/hwillson) in [#3774](https://github.com/apollographql/apollo-client/pull/3774) <br/>
|
3925 | [@hwillson](https://github.com/hwillson) in [#3779](https://github.com/apollographql/apollo-client/pull/3779)
|
3926 |
|
3927 | ### Apollo Boost (0.1.13)
|
3928 |
|
3929 | - No changes.
|
3930 |
|
3931 | ### Apollo Cache In-Memory (1.2.7)
|
3932 |
|
3933 | - No changes.
|
3934 |
|
3935 | ### Apollo Cache (1.1.14)
|
3936 |
|
3937 | - No changes.
|
3938 |
|
3939 | ### Apollo Utilities (1.0.18)
|
3940 |
|
3941 | - No changes.
|
3942 |
|
3943 | ### Apollo GraphQL Anywhere (4.1.16)
|
3944 |
|
3945 | - No changes.
|
3946 |
|
3947 | ## 2.3.7 (July 24, 2018)
|
3948 |
|
3949 | ### Apollo Client (2.3.7)
|
3950 |
|
3951 | - Release 2.3.6 broke Typescript compilation. `QueryManager`'s
|
3952 | `getQueryWithPreviousResult` method included an invalid `variables` return
|
3953 | type in the auto-generated `core/QueryManager.d.ts` declaration file. The
|
3954 | type definition had a locally referenced path, that appears to have been
|
3955 | caused by the typescript compiler getting confused at compile/publish time.
|
3956 | `getQueryWithPreviousResult` return types are now excplicity identified,
|
3957 | which helps Typescript avoid the local type reference. For more details,
|
3958 | see https://github.com/apollographql/apollo-client/issues/3729. <br/>
|
3959 | [@hwillson](https://github.com/hwillson) in [#3731](https://github.com/apollographql/apollo-client/pull/3731)
|
3960 |
|
3961 | ### Apollo Boost (0.1.12)
|
3962 |
|
3963 | - No changes.
|
3964 |
|
3965 | ## 2.3.6 (July 24, 2018)
|
3966 |
|
3967 | ### Apollo Client (2.3.6)
|
3968 |
|
3969 | - Documentation updates. <br/>
|
3970 | [@ananth99](https://github.com/ananth99) in [#3599](https://github.com/apollographql/apollo-client/pull/3599) <br/>
|
3971 | [@hwillson](https://github.com/hwillson) in [#3635](https://github.com/apollographql/apollo-client/pull/3635) <br/>
|
3972 | [@JakeDawkins](https://github.com/JakeDawkins) in [#3642](https://github.com/apollographql/apollo-client/pull/3642) <br/>
|
3973 | [@hwillson](https://github.com/hwillson) in [#3644](https://github.com/apollographql/apollo-client/pull/3644) <br/>
|
3974 | [@gbau](https://github.com/gbau) in [#3644](https://github.com/apollographql/apollo-client/pull/3600) <br/>
|
3975 | [@chentsulin](https://github.com/chentsulin) in [#3608](https://github.com/apollographql/apollo-client/pull/3608) <br/>
|
3976 | [@MikaelCarpenter](https://github.com/MikaelCarpenter) in [#3609](https://github.com/apollographql/apollo-client/pull/3609) <br/>
|
3977 | [@Gamezpedia](https://github.com/Gamezpedia) in [#3612](https://github.com/apollographql/apollo-client/pull/3612) <br/>
|
3978 | [@jinxac](https://github.com/jinxac) in [#3647](https://github.com/apollographql/apollo-client/pull/3647) <br/>
|
3979 | [@abernix](https://github.com/abernix) in [#3705](https://github.com/apollographql/apollo-client/pull/3705) <br/>
|
3980 | [@dandv](https://github.com/dandv) in [#3703](https://github.com/apollographql/apollo-client/pull/3703) <br/>
|
3981 | [@hwillson](https://github.com/hwillson) in [#3580](https://github.com/apollographql/apollo-client/pull/3580) <br/>
|
3982 | - Updated `graphql` `peerDependencies` to handle 14.x versions. <br/>
|
3983 | [@ivank](https://github.com/ivank) in [#3598](https://github.com/apollographql/apollo-client/pull/3598)
|
3984 | - Add optional generic type params for variables on low level methods. <br/>
|
3985 | [@mvestergaard](https://github.com/mvestergaard) in [#3588](https://github.com/apollographql/apollo-client/pull/3588)
|
3986 | - Add a new `awaitRefetchQueries` config option to the Apollo Client
|
3987 | `mutate` function, that when set to `true` will wait for all
|
3988 | `refetchQueries` to be fully refetched, before resolving the mutation
|
3989 | call. `awaitRefetchQueries` is `false` by default. <br/>
|
3990 | [@jzimmek](https://github.com/jzimmek) in [#3169](https://github.com/apollographql/apollo-client/pull/3169)
|
3991 |
|
3992 | ### Apollo Boost (0.1.11)
|
3993 |
|
3994 | - Allow `fetch` to be given as a configuration option to `ApolloBoost`. <br/>
|
3995 | [@mbaranovski](https://github.com/mbaranovski) in [#3590](https://github.com/apollographql/apollo-client/pull/3590)
|
3996 | - The `apollo-boost` `ApolloClient` constructor now warns about unsupported
|
3997 | options. <br/>
|
3998 | [@quentin-](https://github.com/quentin-) in [#3551](https://github.com/apollographql/apollo-client/pull/3551)
|
3999 |
|
4000 | ### Apollo Cache (1.1.13)
|
4001 |
|
4002 | - No changes.
|
4003 |
|
4004 | ### Apollo Cache In-Memory (1.2.6)
|
4005 |
|
4006 | - Add `__typename` and `id` properties to `dataIdFromObject` parameter
|
4007 | (typescript) <br/>
|
4008 | [@jfurler](https://github.com/jfurler) in [#3641](https://github.com/apollographql/apollo-client/pull/3641)
|
4009 | - Fixed an issue caused by `dataIdFromObject` considering returned 0 values to
|
4010 | be falsy, instead of being a valid ID, which lead to the store not being
|
4011 | updated properly in some cases. <br/>
|
4012 | [@hwillson](https://github.com/hwillson) in [#3711](https://github.com/apollographql/apollo-client/pull/3711)
|
4013 |
|
4014 | ### Apollo Utilities (1.0.17)
|
4015 |
|
4016 | - No changes.
|
4017 |
|
4018 | ### Apollo GraphQL Anywhere (4.1.15)
|
4019 |
|
4020 | - Add support for arrays to `graphql-anywhere`'s filter utility. <br/>
|
4021 | [@jsweet314](https://github.com/jsweet314) in [#3591](https://github.com/apollographql/apollo-client/pull/3591)
|
4022 | - Fix `Cannot convert object to primitive value` error that was showing up
|
4023 | when attempting to report a missing property on an object. <br/>
|
4024 | [@benjie](https://github.com/benjie) in [#3618](https://github.com/apollographql/apollo-client/pull/3618)
|
4025 |
|
4026 | ## 2.3.5 (June 19, 2018)
|
4027 |
|
4028 | ### Apollo Client (2.3.5)
|
4029 |
|
4030 | - Internal code formatting updates.
|
4031 | - [@chentsulin](https://github.com/chentsulin) in [#3574](https://github.com/apollographql/apollo-client/pull/3574)
|
4032 | - Documentation updates.
|
4033 | - [@andtos90](https://github.com/andtos90) in [#3596](https://github.com/apollographql/apollo-client/pull/3596)
|
4034 | - [@serranoarevalo](https://github.com/serranoarevalo) in [#3554](https://github.com/apollographql/apollo-client/pull/3554)
|
4035 | - [@cooperka](https://github.com/cooperka) in [#3594](https://github.com/apollographql/apollo-client/pull/3594)
|
4036 | - [@pravdomil](https://github.com/pravdomil) in [#3587](https://github.com/apollographql/apollo-client/pull/3587)
|
4037 | - [@excitement-engineer](https://github.com/excitement-engineer) in [#3309](https://github.com/apollographql/apollo-client/pull/3309)
|
4038 |
|
4039 | ### Apollo Boost (0.1.10)
|
4040 |
|
4041 | - No changes.
|
4042 |
|
4043 | ### Apollo Cache (1.1.12)
|
4044 |
|
4045 | - No changes.
|
4046 |
|
4047 | ### Apollo Cache In-Memory (1.2.5)
|
4048 |
|
4049 | - No changes.
|
4050 |
|
4051 | ### Apollo Utilities (1.0.16)
|
4052 |
|
4053 | - Removed unnecessary whitespace from error message.
|
4054 | - [@mbaranovski](https://github.com/mbaranovski) in [#3593](https://github.com/apollographql/apollo-client/pull/3593)
|
4055 |
|
4056 | ### Apollo GraphQL Anywhere (4.1.14)
|
4057 |
|
4058 | - No changes.
|
4059 |
|
4060 | ## 2.3.4 (June 13, 2018)
|
4061 |
|
4062 | ### Apollo Client (2.3.4)
|
4063 |
|
4064 | - Export the `QueryOptions` interface, to make sure it can be used by other
|
4065 | projects (like `apollo-angular`).
|
4066 | - Fixed an issue caused by typescript changes to the constructor
|
4067 | `defaultOptions` param, that prevented `query` defaults from passing type
|
4068 | checks.
|
4069 | ([@hwillson](https://github.com/hwillson) in [#3585](https://github.com/apollographql/apollo-client/pull/3585))
|
4070 |
|
4071 | ### Apollo Boost (0.1.9)
|
4072 |
|
4073 | - No changes
|
4074 |
|
4075 | ### Apollo Cache (1.1.11)
|
4076 |
|
4077 | - No changes
|
4078 |
|
4079 | ### Apollo Cache In-Memory (1.2.4)
|
4080 |
|
4081 | - No changes
|
4082 |
|
4083 | ### Apollo Utilities (1.0.15)
|
4084 |
|
4085 | - No changes
|
4086 |
|
4087 | ### Apollo GraphQL Anywhere (4.1.13)
|
4088 |
|
4089 | - No changes
|
4090 |
|
4091 | ## 2.3.3 (June 13, 2018)
|
4092 |
|
4093 | ### Apollo Client (2.3.3)
|
4094 |
|
4095 | - Typescript improvements. Made observable query parameterized on data and
|
4096 | variables: `ObservableQuery<TData, TVariables>`
|
4097 | ([@excitement-engineer](https://github.com/excitement-engineer) in [#3140](https://github.com/apollographql/apollo-client/pull/3140))
|
4098 | - Added optional generics to cache manipulation methods (typescript).
|
4099 | ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541))
|
4100 | - Typescript improvements. Created a new `QueryOptions` interface that
|
4101 | is now used by `ApolloClient.query` options, instead of the previous
|
4102 | `WatchQueryOptions` interface. This helps reduce confusion (especially
|
4103 | in the docs) that made it look like `ApolloClient.query` accepted
|
4104 | `ApolloClient.watchQuery` only options, like `pollingInterval`.
|
4105 | ([@hwillson](https://github.com/hwillson) in [#3569](https://github.com/apollographql/apollo-client/pull/3569))
|
4106 |
|
4107 | ### Apollo Boost (0.1.8)
|
4108 |
|
4109 | - Allow `cache` to be given as a configuration option to `ApolloBoost`.
|
4110 | ([@dandean](https://github.com/dandean) in [#3561](https://github.com/apollographql/apollo-client/pull/3561))
|
4111 | - Allow `headers` and `credentials` to be passed in as configuration
|
4112 | parameters to the `apollo-boost` `ApolloClient` constructor.
|
4113 | ([@rzane](https://github.com/rzane) in [#3098](https://github.com/apollographql/apollo-client/pull/3098))
|
4114 |
|
4115 | ### Apollo Cache (1.1.10)
|
4116 |
|
4117 | - Added optional generics to cache manipulation methods (typescript).
|
4118 | ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541))
|
4119 |
|
4120 | ### Apollo Cache In-Memory (1.2.3)
|
4121 |
|
4122 | - Added optional generics to cache manipulation methods (typescript).
|
4123 | ([@mvestergaard](https://github.com/mvestergaard) in [#3541](https://github.com/apollographql/apollo-client/pull/3541))
|
4124 | - Restore non-enumerability of `resultFields[ID_KEY]`.
|
4125 | ([@benjamn](https://github.com/benjamn) in [#3544](https://github.com/apollographql/apollo-client/pull/3544))
|
4126 | - Cache query documents transformed by InMemoryCache.
|
4127 | ([@benjamn](https://github.com/benjamn) in [#3553](https://github.com/apollographql/apollo-client/pull/3553))
|
4128 |
|
4129 | ### Apollo Utilities (1.0.14)
|
4130 |
|
4131 | - Store key names generated by `getStoreKeyName` now leverage a more
|
4132 | deterministic approach to handling JSON based strings. This prevents store
|
4133 | key names from differing when using `args` like
|
4134 | `{ prop1: 'value1', prop2: 'value2' }` and
|
4135 | `{ prop2: 'value2', prop1: 'value1' }`.
|
4136 | ([@gdi2290](https://github.com/gdi2290) in [#2869](https://github.com/apollographql/apollo-client/pull/2869))
|
4137 | - Avoid needless `hasOwnProperty` check in `deepFreeze`.
|
4138 | ([@benjamn](https://github.com/benjamn) in [#3545](https://github.com/apollographql/apollo-client/pull/3545))
|
4139 |
|
4140 | ### Apollo GraphQL Anywhere (4.1.12)
|
4141 |
|
4142 | - No new changes.
|
4143 |
|
4144 | ## 2.3.2 (May 29, 2018)
|
4145 |
|
4146 | ### Apollo Client (2.3.2)
|
4147 |
|
4148 | - Fix SSR and `cache-and-network` fetch policy
|
4149 | ([@dastoori](https://github.com/dastoori) in [#3372](https://github.com/apollographql/apollo-client/pull/3372))
|
4150 | - Fixed an issue where the `updateQuery` method passed to
|
4151 | `ObservableQuery.fetchMore` was receiving the original query variables,
|
4152 | instead of the new variables that it used to fetch more data.
|
4153 | ([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3500](https://github.com/apollographql/apollo-client/pull/3500))
|
4154 | - Fixed an issue involving `Object.setPrototypeOf()` not working on JSC
|
4155 | (Android), by instead setting the `prototype` of `this` manually.
|
4156 | ([@seklyza](https://github.com/seklyza) in [#3306](https://github.com/apollographql/apollo-client/pull/3306))
|
4157 | - Added safeguards to make sure `QueryStore.initQuery` and
|
4158 | `QueryStore.markQueryResult` don't try to set the network status of a
|
4159 | `fetchMoreForQueryId` query, if it does not exist in the store. This was
|
4160 | happening when a query component was unmounted while a `fetchMore` was still
|
4161 | in flight.
|
4162 | ([@conrad-vanl](https://github.com/conrad-vanl) in [#3367](https://github.com/apollographql/apollo-client/pull/3367), [@doomsower](https://github.com/doomsower) in [#3469](https://github.com/apollographql/apollo-client/pull/3469))
|
4163 |
|
4164 | ### Apollo Boost (0.1.7)
|
4165 |
|
4166 | - Various internal code cleanup, tooling and dependency changes.
|
4167 |
|
4168 | ### Apollo Cache (1.1.9)
|
4169 |
|
4170 | - Various internal code cleanup, tooling and dependency changes.
|
4171 |
|
4172 | ### Apollo Cache In-Memory (1.2.2)
|
4173 |
|
4174 | - Fixed an issue that caused fragment only queries to sometimes fail.
|
4175 | ([@abhiaiyer91](https://github.com/abhiaiyer91) in [#3507](https://github.com/apollographql/apollo-client/pull/3507))
|
4176 | - Fixed cache invalidation for inlined mixed types in union fields within
|
4177 | arrays.
|
4178 | ([@dferber90](https://github.com/dferber90) in [#3422](https://github.com/apollographql/apollo-client/pull/3422))
|
4179 |
|
4180 | ### Apollo Utilities (1.0.13)
|
4181 |
|
4182 | - Make `maybeDeepFreeze` a little more defensive, by always using
|
4183 | `Object.prototype.hasOwnProperty` (to avoid cases where the object being
|
4184 | frozen doesn't have its own `hasOwnProperty`).
|
4185 | ([@jorisroling](https://github.com/jorisroling) in [#3418](https://github.com/apollographql/apollo-client/pull/3418))
|
4186 | - Remove certain small internal caches to prevent memory leaks when using SSR.
|
4187 | ([@brunorzn](https://github.com/brunorzn) in [#3444](https://github.com/apollographql/apollo-client/pull/3444))
|
4188 |
|
4189 | ### Apollo GraphQL Anywhere (4.1.11)
|
4190 |
|
4191 | - Source files are now excluded when publishing to npm.
|
4192 | ([@hwillson](https://github.com/hwillson) in [#3454](https://github.com/apollographql/apollo-client/pull/3454))
|
4193 |
|
\ | No newline at end of file |