Skip to content

Commit c2f00bc

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

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ const client = new ApolloClient({
589589
// ...
590590
});
591591
```
592-
592+
Previously, all Apollo Client instances were bundled with local state management functionality, even if you didn't use the `@client` directive. This change means local state management is now opt-in and reduces the size of your bundle when you aren't using this feature.
593593
### Change `connectToDevTools`
594594

595595
The `connectToDevTools` option has been replaced with a new `devtools` option that contains an `enabled` property.
@@ -618,8 +618,9 @@ const client = new ApolloClient({
618618

619619
### Enable incremental delivery (`@defer`)
620620

621-
In Apollo Client 4, you can swap out the incremental delivery protocol implementation.
622-
That means if you were using `@defer` previously, you should now enable the new `Defer20220824Handler` by passing it to the `incrementalHandler` option.
621+
The incremental delivery protocol implementation is now configurable and requires you to opt-in to use the proper format. If you currently use `@defer` in your application, you need to configure an incremental handler and provide it to the `incrementalHandler` option to the `ApolloClient` constructor.
622+
623+
Since Apollo Client 3 only supported an older version of the specification, initialize an instance of `Defer20220824Handler` and provide it as the `incrementalHandler` option.
623624

624625
```ts
625626
import { Defer20220824Handler } from "@apollo/client/incremental"; // [!code ++]
@@ -630,10 +631,9 @@ const client = new ApolloClient({
630631
});
631632
```
632633

633-
Additionally, you should enable the `TypeOverrides` for the `Defer20220824Handler`.
634-
This will add the deferred chunk types to `ApolloLink.Result` and ensures that you handle incremental results correctly in custom links that might access `result` directly.
634+
To provide accurate TypeScript types, you will also need tell Apollo Client to use the types associated with the `Defer20220824Handler` in order to provide accurate types for incremental chunks, used with the `ApolloLink.Result` type. This ensures that you properly handle incremental results in your custom links that might access the result directly.
635635

636-
To do so, create a new `.d.ts` file in your project (e.g. `apollo-client.d.ts`) and add the following content:
636+
Create a new `.d.ts` file in your project (e.g. `apollo-client.d.ts`) and add the following content:
637637

638638
```ts title="apollo-client.d.ts
639639
import { Defer20220824Handler } from "@apollo/client/incremental"; // [!code highlight]
@@ -645,7 +645,7 @@ declare module "@apollo/client" {
645645

646646
<Note>
647647

648-
Over time, we will introduce additional incremental handlers to support different proposals of the protocol.
648+
Apollo Client only provides support for the older incremental specification at this time. Future versions will introduce new incremental handlers to support more recent versions of the specification.
649649

650650
</Note>
651651

0 commit comments

Comments
 (0)