v4.0.0-alpha.12
Breaking Changes📦 apollo-client
⚠ 5 breaking🔧 10 symbols
Summary
Apollo Client 4.x introduces breaking changes: removal of `typeDefs`, `TContext`, and support for `graphql` v15, a mandatory `link` option, and a renamed link entrypoint, requiring migration steps for existing code.
⚠️ Breaking Changes
- Removed the `typeDefs` option from `ApolloClient`; code that passed `typeDefs` must be updated to use schema definitions via other mechanisms.
- Removed the `TContext` generic argument from all types; replace usages with `DefaultContext` and customize via declaration merging.
- Dropped `graphql` v15 as a valid peer dependency; upgrade to `graphql` v16 or later.
- Renamed the entrypoint `@apollo/client/link/core` to `@apollo/client/link`; update import statements accordingly.
- Made the `link` option mandatory when constructing `ApolloClient`, removing `uri`, `credentials`, and `headers` options; migrate by providing an instantiated `HttpLink` or `ApolloLink.empty()`.
Migration Steps
- If you previously used the `typeDefs` option, remove it and provide schema via other mechanisms.
- Replace any `TContext` generic arguments with `DefaultContext` and use declaration merging to extend it.
- Update imports from `@apollo/client/link/core` to `@apollo/client/link`.
- When creating an `ApolloClient`, replace `uri`, `credentials`, and `headers` options with a `link` option, e.g., `link: new HttpLink({ uri, credentials, headers })` or `link: createHttpLink({ uri, credentials, headers })`. If no link is needed, use `link: ApolloLink.empty()`.
🔧 Affected Symbols
ApolloClienttypeDefsTContextDefaultContextgraphql@apollo/client/link/core@apollo/client/linkHttpLinkcreateHttpLinkApolloLink.empty