Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
"@apollo/client-graphql-codegen": "2.0.0",
"@apollo/client-codemod-migrate-3-to-4": "1.0.2"
},
"changesets": []
"changesets": [
"fuzzy-hairs-tie"
]
}
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# @apollo/client

## 4.3.0-alpha.0

### Minor Changes

- [#13250](https://github.com/apollographql/apollo-client/pull/13250) [`bad7035`](https://github.com/apollographql/apollo-client/commit/bad7035565e15c18800080d9e0abf1d89b3d82fa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add the ability to define the cache type for the client. `client.cache` currently returns `ApolloCache` as the cache type regardless of what cache you've provided to `ApolloClient`.

Declare the cache type using the `cache` property in the `TypeOverrides` interface to set the cache implementation used for the client.

```ts
// apollo.d.ts
import type { InMemoryCache } from "@apollo/client";

declare module "@apollo/client" {
export interface TypeOverrides {
cache: InMemoryCache;
}
}
```

Now anywhere `cache` is accessible, the type is the declared cache type:

```ts
client.cache;
// ^? InMemoryCache

client.mutate({
update: (cache) => {
// ^? InMemoryCache
},
});
```

> [!NOTE]
> Setting a cache type enforces that cache type in the `cache` option for the `ApolloClient` constructor.

## 4.2.3

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/client",
"version": "4.2.3",
"version": "4.3.0-alpha.0",
"description": "A fully-featured caching GraphQL client.",
"private": true,
"keywords": [
Expand Down