Skip to content

Commit cd15cd2

Browse files
Apply suggestions from code review
Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
1 parent 639f811 commit cd15cd2

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

config/prettier/format-mdx3.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const specialCommentPattern = new RegExp(
3737
`(${patterns.map((p) => `(${p.source})`).join("|")})`,
3838
"gm"
3939
);
40-
console.log(specialCommentPattern.source);
4140

4241
/**
4342
* Applied to code blocks to preserve special comments like `// [!code ...]` on the same line.

docs/source/migrating/apollo-client-4-migration.mdx

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,28 @@ Apollo Client 3.14 introduces many deprecations and warnings that will help you
1414
## What’s new in 4.0
1515

1616
- Bundling changes
17-
- Apollo Client 4.0 now has an `exports` field in its `package.json` for better ESM support
18-
- `@apollo/client/core` and `@apollo/client` are now identical and framework-agnostic. React-related exports are now only available in `@apollo/client/react`.
17+
- Apollo Client 4.0 now includes an `exports` field in its `package.json` for better ESM support
18+
- `@apollo/client` is now framework-agnostic. React-related exports have been removed and are now only available in `@apollo/client/react`
19+
- As a result `@apollo/client/core` and `@apollo/client` are now identical
1920
- Enhanced Error Handling
20-
- network errors are now handled the same way as GraphQL errors and populate the `error` field of a query result
21-
- the throwing behaviour between network errors and GraphQL errors has been unified
22-
- `ApolloError` has been removed. A number of new error classes have been introduced, and external errors are now passed through as-is without wrapping them, which enables easier debugging.
21+
- Network errors and GraphQL errors have been unified into a single `error` property of a query result
22+
- Network errors now adhere to the `errorPolicy` in the same way as GraphQL errors
23+
- `ApolloError` has been removed in favor of more granular error classes
24+
- Network errors are now passed through as-is without wrapping them in a separate error class, making them easier to debug
2325
- TypeScript improvements
24-
- APIs like `client.query` or `useQuery` that accept variables in options will now require the variables to be passed in if any option is non-optional.
26+
- The `variables` option used throughout various client APIs (e.g. `client.query` or `useQuery`) now requires that the `variables` option is provided if any variable is non-optional.
2527
- return types are more precise, taking options into account - if you pass in the `returnPartialData` option, `data` on the return object will be `DeepPartial<TData>`
26-
- added a new `dataState` property that contains information about the state of the `data` property of a return value. This property can be used to narrow down the type of `data`.
27-
- most types are now colocated within the API that they relate to, so it is much easier to find the right type for the right situation.
28-
- some core types like types for `DataMasking` or types representing the that `dataState` narrows down to can now be overwritten.
28+
- A new `dataState` property has been added that contains information about the state of the `data` property which can be used to accurately narrow down the type of `data`.
29+
- Types are now generally colocated in a namespace with the API that owns them, making them more discoverable with clear ownership boundaries
30+
- Selective core types, such as those used for data masking, can now be overridden to provide your own type implementations
2931
- Local State changes
30-
- The local resolver implementation is now a pluggable `LocalState` class to save on bundle size for everyone who doesn't use it.
32+
- Local state management (e.g. the `@client` directive) is now an opt-in feature to reduce the bundle size of client when local state is not used
3133
- Many improvements and bug fixes in the new `LocalState` implementation
32-
- The `Observable` implementation has been changed to `rxjs`.
33-
- The incremental delivery implementation has been made pluggable, so in the future we can support multiple different versions of the incremental delivery protocol.
34-
- For a full list of changes, see the [changelog](https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md).
34+
- The `Observable` implementation now uses `rxjs` instead of `zen-observable`.
35+
- The incremental delivery implementation is now pluggable. This makes it possible to support multiple versions of the incremental delivery protocol thoughout.
36+
37+
For a full list of changes, see the [changelog]
38+
(https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md).
3539

3640
## Installation
3741

@@ -43,10 +47,16 @@ Apollo Client 4.0 is a major-version release that includes breaking changes. If
4347

4448
Install Apollo Client 4 along with its peer dependencies with the following command:
4549

46-
```
50+
```sh
4751
npm install @apollo/client graphql rxjs
4852
```
4953

54+
<Note>
55+
56+
`rxjs` is a new peer dependency with Apollo Client 4.0.
57+
58+
</Note>
59+
5060
## Codemod
5161

5262
To ease the migration process, we have created a codemod that will automatically update your codebase to use the new imports and APIs in Apollo Client 4.

0 commit comments

Comments
 (0)