Skip to content

Commit dde5f0c

Browse files
Version Packages (alpha) (#12570)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 99d72bf commit dde5f0c

File tree

4 files changed

+132
-3
lines changed

4 files changed

+132
-3
lines changed

.changeset/pre.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"clean-sheep-hide",
1616
"clever-zebras-mate",
1717
"cool-bikes-shake",
18+
"cool-kiwis-hunt",
1819
"cuddly-spiders-tie",
1920
"curvy-pianos-count",
2021
"dirty-eagles-poke",
@@ -27,18 +28,24 @@
2728
"forty-hairs-occur",
2829
"forty-shrimps-fry",
2930
"forty-tomatoes-punch",
31+
"four-countries-clean",
3032
"four-ghosts-watch",
3133
"fresh-moose-hope",
3234
"funny-jeans-invent",
35+
"funny-terms-deny",
3336
"fuzzy-tips-sit",
37+
"gentle-badgers-train",
3438
"giant-apes-thank",
3539
"giant-bags-share",
3640
"good-dolphins-peel",
3741
"gorgeous-chefs-tap",
42+
"great-roses-jog",
3843
"grumpy-vans-type",
3944
"healthy-apes-sneeze",
4045
"hip-vans-act",
4146
"hot-cycles-notice",
47+
"hungry-bikes-cough",
48+
"itchy-chefs-run",
4249
"itchy-drinks-refuse",
4350
"itchy-roses-accept",
4451
"khaki-keys-deliver",
@@ -65,6 +72,7 @@
6572
"nice-dots-matter",
6673
"nice-waves-work",
6774
"ninety-bags-bake",
75+
"odd-chicken-hide",
6876
"odd-lemons-relax",
6977
"perfect-vans-give",
7078
"polite-bees-care",
@@ -78,6 +86,8 @@
7886
"rich-eagles-cross",
7987
"rich-kids-carry",
8088
"rude-fans-study",
89+
"serious-moons-juggle",
90+
"seven-dragons-repair",
8191
"seven-foxes-melt",
8292
"shaggy-pugs-add",
8393
"shiny-carrots-invent",
@@ -104,6 +114,7 @@
104114
"tender-swans-flash",
105115
"thick-books-grin",
106116
"thin-peas-hear",
117+
"tidy-pandas-punch",
107118
"tidy-squids-poke",
108119
"tough-rockets-allow",
109120
"tough-taxis-smoke",
@@ -116,6 +127,7 @@
116127
"wicked-forks-double",
117128
"yellow-cats-judge",
118129
"young-phones-fold",
130+
"young-snails-grin",
119131
"young-turtles-explode"
120132
]
121133
}

CHANGELOG.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,122 @@
11
# @apollo/client
22

3+
## 4.0.0-alpha.10
4+
5+
### Major Changes
6+
7+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `ObservableQuery.variables` can now be reset back to empty when calling `reobserve` with `variables: undefined`. Previously the `variables` key would be ignored so `variables` would remain unchanged.
8+
9+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `never` is no longer supported as a valid `TVariables` generic argument for APIs that require `variables` as part of its type. Use `Record<string, never>` instead.
10+
11+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - When passing a `variables` key with the value `undefined`, the value will be replaced by the default value in the query, if it is provided, rather than leave it as `undefined`.
12+
13+
```ts
14+
// given this query
15+
const query = gql`
16+
query PaginatedQuery($limit: Int! = 10, $offset: Int) {
17+
list(limit: $limit, offset: $offset) {
18+
id
19+
}
20+
}
21+
`;
22+
23+
const observable = client.query({
24+
query,
25+
variables: { limit: 5, offset: 0 },
26+
});
27+
console.log(observable.variables); // => { limit: 5, offset: 0 }
28+
29+
observable.reobserve({ variables: { limit: undefined, offset: 10 } });
30+
// limit is now `10`. This would previously be `undefined`
31+
console.log(observable.variables); // => { limit: 10, offset: 10 }
32+
```
33+
34+
- [#12562](https://github.com/apollographql/apollo-client/pull/12562) [`90bf0e6`](https://github.com/apollographql/apollo-client/commit/90bf0e61516a382182f212ac8ab891099e2eb009) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `client.query` no longer supports a `fetchPolicy` of `standby`. `standby` does not fetch and did not return `data`. `standby` is meant for watched queries where fetching should be on hold.
35+
36+
### Minor Changes
37+
38+
- [#12557](https://github.com/apollographql/apollo-client/pull/12557) [`51d26ae`](https://github.com/apollographql/apollo-client/commit/51d26ae631c6631a189c98ea9357b18e77a9a876) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add ability to specify message formatter for `CombinedGraphQLErrors` and `CombinedProtocolErrors`. To provide your own message formatter, override the static `formatMessage` property on these classes.
39+
40+
```ts
41+
CombinedGraphQLErrors.formatMessage = (
42+
errors,
43+
{ result, defaultFormatMessage }
44+
) => {
45+
return "Some formatted message";
46+
};
47+
48+
CombinedProtocolErrors.formatMessage = (errors, { defaultFormatMessage }) => {
49+
return "Some formatted message";
50+
};
51+
```
52+
53+
- [#12546](https://github.com/apollographql/apollo-client/pull/12546) [`5dffbbe`](https://github.com/apollographql/apollo-client/commit/5dffbbe407eb1d9adbcb0fff89f2d3a75dc1ad2b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a static `is` method to error types defined by Apollo Client. `is` makes it simpler to determine whether an error is a specific type, which can be helpful in cases where you'd like to narrow the error type in order to use specific properties from that error.
54+
55+
This change applies to the following error types:
56+
57+
- `CombinedGraphQLErrors`
58+
- `CombinedProtocolErrors`
59+
- `ServerError`
60+
- `ServerParseError`
61+
- `UnconventionalError`
62+
63+
**Example**
64+
65+
```ts
66+
import { CombinedGraphQLErrors } from "@apollo/client";
67+
68+
if (CombinedGraphQLErrors.is(error)) {
69+
console.log(error.message);
70+
error.errors.forEach((graphQLError) => console.log(graphQLError.message));
71+
}
72+
```
73+
74+
- [#12561](https://github.com/apollographql/apollo-client/pull/12561) [`99d72bf`](https://github.com/apollographql/apollo-client/commit/99d72bfdb38e3d9679f60b9acb065a84e3b42fd6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to detect if an error was an error was emitted from the link chain. This is useful if your application throws custom errors in other areas of the application and you'd like to differentiate them from errors emitted by the link chain itself.
75+
76+
To detect if an error was emitted from the link chain, use `LinkError.is`.
77+
78+
```ts
79+
import { LinkError } from "@apollo/client";
80+
81+
client.query({ query }).catch((error) => {
82+
if (LinkError.is(error)) {
83+
// This error originated from the link chain
84+
}
85+
});
86+
```
87+
88+
### Patch Changes
89+
90+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The `variables` option used with various APIs are now enforced more consistently across the client when `TVariables` contains required variables. If required `variables` are not provided, TypeScript will now complain that it requires a `variables` option.
91+
92+
This change affects the following APIs:
93+
94+
- `client.query`
95+
- `client.mutate`
96+
- `client.subscribe`
97+
- `client.watchQuery`
98+
- `useBackgroundQuery`
99+
- `useQuery`
100+
- `useSubscription`
101+
- `useSuspenseQuery`
102+
103+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix type of `variables` returned from `useLazyQuery`. When `called` is `false`, `variables` is now `Partial<TVariables>` instead of `TVariables`.
104+
105+
- [#12562](https://github.com/apollographql/apollo-client/pull/12562) [`90bf0e6`](https://github.com/apollographql/apollo-client/commit/90bf0e61516a382182f212ac8ab891099e2eb009) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `client.query` no longer supports `notifyOnNetworkStatusChange` in options. An error will be thrown if this option is set. The effects of this option were not observable by `client.query` since `client.query` emits a single result.
106+
107+
- [#12557](https://github.com/apollographql/apollo-client/pull/12557) [`51d26ae`](https://github.com/apollographql/apollo-client/commit/51d26ae631c6631a189c98ea9357b18e77a9a876) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Update format of the error message for `CombinedGraphQLErrors` and `CombinedProtocolErrors` to be more like v3.x.
108+
109+
```diff
110+
console.log(error.message);
111+
- `The GraphQL server returned with errors:
112+
- - Email not found
113+
- - Username already in use`
114+
+ `Email not found
115+
+ Username already in use`
116+
```
117+
118+
- [#12559](https://github.com/apollographql/apollo-client/pull/12559) [`49ace0e`](https://github.com/apollographql/apollo-client/commit/49ace0e2119b7fd5997dcf051002ebd4ba2e0bc4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `ObservableQuery.variables` has been updated to return `TVariables` rather than `TVariables | undefined`. This is more consistent with the runtime value where an empty object (`{}`) will be returned when the `variables` option is not provided.
119+
3120
## 4.0.0-alpha.9
4121

5122
### Major Changes

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apollo/client",
3-
"version": "4.0.0-alpha.9",
3+
"version": "4.0.0-alpha.10",
44
"description": "A fully-featured caching GraphQL client.",
55
"private": true,
66
"keywords": [

0 commit comments

Comments
 (0)