apollo-client icon indicating copy to clipboard operation
apollo-client copied to clipboard

Make client writeFragment and writeQuery behaviour consistent with cache

Open andrebrantom opened this issue 3 years ago • 2 comments

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 avatar Nov 26 '21 10:11 andrebrantom

@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/

apollo-cla avatar Nov 26 '21 10:11 apollo-cla

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.

andrebrantom avatar Jun 12 '22 10:06 andrebrantom

🦋 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

changeset-bot[bot] avatar Feb 20 '23 20:02 changeset-bot[bot]