You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/migrating/apollo-client-4-migration.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -589,7 +589,7 @@ const client = new ApolloClient({
589
589
// ...
590
590
});
591
591
```
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.
593
593
### Change `connectToDevTools`
594
594
595
595
The `connectToDevTools` option has been replaced with a new `devtools` option that contains an `enabled` property.
@@ -618,8 +618,9 @@ const client = new ApolloClient({
618
618
619
619
### Enable incremental delivery (`@defer`)
620
620
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.
@@ -630,10 +631,9 @@ const client = new ApolloClient({
630
631
});
631
632
```
632
633
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.
635
635
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:
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.
0 commit comments