@apollo/client 4.1.8 → 4.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/__cjs/version.cjs +1 -1
- package/package.json +1 -6
- package/skills/apollo-client/references/error-handling.md +8 -2
- package/skills/apollo-client/references/integration-client.md +4 -8
- package/skills/apollo-client/references/state-management.md +1 -1
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#13203](https://github.com/apollographql/apollo-client/pull/13203) [`099954b`](https://github.com/apollographql/apollo-client/commit/099954b9905c0f80b57563eb64157386f4493e84) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Remove the `workspaces` field from the published `package.json` in `dist` to avoid Yarn v1 warnings about workspaces requiring private packages.
|
|
8
|
+
|
|
3
9
|
## 4.1.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/__cjs/version.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.9",
|
|
4
4
|
"description": "A fully-featured caching GraphQL client.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -344,10 +344,5 @@
|
|
|
344
344
|
"**/*.js.map",
|
|
345
345
|
"**/*.d.ts",
|
|
346
346
|
"**/*.json"
|
|
347
|
-
],
|
|
348
|
-
"workspaces": [
|
|
349
|
-
"dist",
|
|
350
|
-
"codegen",
|
|
351
|
-
"scripts/codemods/ac3-to-ac4"
|
|
352
347
|
]
|
|
353
348
|
}
|
|
@@ -309,6 +309,12 @@ When using suspenseful hooks, you should use React Error Boundaries for graceful
|
|
|
309
309
|
### Non-suspense per-Component Error Handling
|
|
310
310
|
|
|
311
311
|
```tsx
|
|
312
|
+
import {
|
|
313
|
+
CombinedGraphQLErrors,
|
|
314
|
+
ServerError,
|
|
315
|
+
ServerParseError,
|
|
316
|
+
} from "@apollo/client/errors";
|
|
317
|
+
|
|
312
318
|
function SafeUserList() {
|
|
313
319
|
const { data, error, loading, refetch } = useQuery(GET_USERS, {
|
|
314
320
|
errorPolicy: "all",
|
|
@@ -316,7 +322,7 @@ function SafeUserList() {
|
|
|
316
322
|
});
|
|
317
323
|
|
|
318
324
|
// Handle network errors
|
|
319
|
-
if (error
|
|
325
|
+
if (ServerError.is(error) || ServerParseError.is(error)) {
|
|
320
326
|
return (
|
|
321
327
|
<Alert severity="error">
|
|
322
328
|
<AlertTitle>Connection Error</AlertTitle>
|
|
@@ -329,7 +335,7 @@ function SafeUserList() {
|
|
|
329
335
|
// Handle GraphQL errors but still show available data
|
|
330
336
|
return (
|
|
331
337
|
<div>
|
|
332
|
-
{error
|
|
338
|
+
{CombinedGraphQLErrors.is(error) && (
|
|
333
339
|
<Alert severity="warning">
|
|
334
340
|
Some data may be incomplete: {error.graphQLErrors[0].message}
|
|
335
341
|
</Alert>
|
|
@@ -100,13 +100,9 @@ function UserList() {
|
|
|
100
100
|
if (loading) return <p>Loading...</p>;
|
|
101
101
|
if (error) return <p>Error: {error.message}</p>;
|
|
102
102
|
|
|
103
|
-
// TypeScript:
|
|
103
|
+
// TypeScript note: for stricter type narrowing, you can also check `dataState === "complete"` before accessing data
|
|
104
104
|
return (
|
|
105
|
-
<ul>
|
|
106
|
-
{data.users.map((user) => (
|
|
107
|
-
<li key={user.id}>{user.name}</li>
|
|
108
|
-
))}
|
|
109
|
-
</ul>
|
|
105
|
+
<ul>{data?.users.map((user) => <li key={user.id}>{user.name}</li>)}</ul>
|
|
110
106
|
);
|
|
111
107
|
}
|
|
112
108
|
```
|
|
@@ -134,8 +130,8 @@ function UserProfile({ userId }: { userId: string }) {
|
|
|
134
130
|
if (loading) return <p>Loading...</p>;
|
|
135
131
|
if (error) return <p>Error: {error.message}</p>;
|
|
136
132
|
|
|
137
|
-
// TypeScript:
|
|
138
|
-
return <div>{data
|
|
133
|
+
// TypeScript note: for stricter type narrowing, you can also check `dataState === "complete"` before accessing data
|
|
134
|
+
return <div>{data?.user.name}</div>;
|
|
139
135
|
}
|
|
140
136
|
```
|
|
141
137
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- [Reactive Variables](#reactive-variables)
|
|
6
6
|
- [Local-Only Fields](#local-only-fields)
|
|
7
|
-
- [
|
|
7
|
+
- [LocalState Resolvers](#localstate-resolvers)
|
|
8
8
|
- [Combining Remote and Local State](#combining-remote-and-local-state)
|
|
9
9
|
- [useReactiveVar Hook](#usereactivevar-hook)
|
|
10
10
|
|
package/version.js
CHANGED