apollo-client
apollo-client copied to clipboard
Make client writeFragment and writeQuery behaviour consistent with cache
This change makes the API and behaviour of ApolloClient::writeFragment consistent with that of Cache::writeFragment in that it returns the Reference of the changed object. This is useful if you have some cache manipulation functions that need to run either against the client in a hook or component, or in a mutation update() handler.
I created an issue here: https://github.com/apollographql/apollo-feature-requests/issues/319
@andrebrantom: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/
Apologies for letting this hang, I've just updated both writeQuery and writeFragment as suggested, I also updated DataProxy::writeFragment and DataProxy::writeQuery return types to match. Not sure if that might break something, but it means DataProxy can now be used to abstract either cache or client for writes.
🦋 Changeset detected
Latest commit: 25e63ca513b3782f84c14d7c506ffc818e0591f9
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @apollo/client | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR