Skip to content

Commit b26cdde

Browse files
Version Packages (alpha)
1 parent fd7369e commit b26cdde

4 files changed

Lines changed: 41 additions & 4 deletions

File tree

.changeset/pre.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"@apollo/client-graphql-codegen": "2.0.0",
77
"@apollo/client-codemod-migrate-3-to-4": "1.0.2"
88
},
9-
"changesets": []
9+
"changesets": [
10+
"fuzzy-hairs-tie"
11+
]
1012
}

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# @apollo/client
22

3+
## 4.3.0-alpha.0
4+
5+
### Minor Changes
6+
7+
- [#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`.
8+
9+
Declare the cache type using the `cache` property in the `TypeOverrides` interface to set the cache implementation used for the client.
10+
11+
```ts
12+
// apollo.d.ts
13+
import type { InMemoryCache } from "@apollo/client";
14+
15+
declare module "@apollo/client" {
16+
export interface TypeOverrides {
17+
cache: InMemoryCache;
18+
}
19+
}
20+
```
21+
22+
Now anywhere `cache` is accessible, the type is the declared cache type:
23+
24+
```ts
25+
client.cache;
26+
// ^? InMemoryCache
27+
28+
client.mutate({
29+
update: (cache) => {
30+
// ^? InMemoryCache
31+
},
32+
});
33+
```
34+
35+
> [!NOTE]
36+
> Setting a cache type enforces that cache type in the `cache` option for the `ApolloClient` constructor.
37+
338
## 4.2.3
439

540
### Patch Changes

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apollo/client",
3-
"version": "4.2.3",
3+
"version": "4.3.0-alpha.0",
44
"description": "A fully-featured caching GraphQL client.",
55
"private": true,
66
"keywords": [

0 commit comments

Comments
 (0)