Skip to content

Commit

Permalink
Mention PR #5909 in CHANGELOG.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Feb 10, 2020
1 parent 7c5d4fd commit 6fdab9d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@
- The result caching system (introduced in [#3394](https://github.com/apollographql/apollo-client/pull/3394)) now tracks dependencies at the field level, rather than at the level of whole entity objects, allowing the cache to return identical (`===`) results much more often than before. <br/>
[@benjamn](https://github.com/benjamn) in [#5617](https://github.com/apollographql/apollo-client/pull/5617)

- `InMemoryCache` now has a method called `modify` which can be used to update the value of a specific field within a specific entity object:
```ts
cache.modify(cache.identify(post), {
comments(comments: Reference[], { readField }) {
return comments.filter(comment => idToRemove !== readField("id", comment));
},
});
```
This API gracefully handles cases where multiple field values are associated with a single field name, and also removes the need for updating the cache by reading a query or fragment, modifying the result, and writing the modified result back into the cache. <br/>
[@benjamn](https://github.com/benjamn) in [#5909](https://github.com/apollographql/apollo-client/pull/5909)

- `InMemoryCache` provides a new API for storing local state that can be easily updated by external code:
```ts
const lv = cache.makeLocalVar(123)
Expand Down

0 comments on commit 6fdab9d

Please sign in to comment.