Hi!
I want to use the client of react-apollo to reset part of the cache from a key or query, not clean the entirely cache using the client.resetStore().
Example:
import { withApollo } from "react-apollo";
import { compose } from "recompose";
import MyComponent from "./MyComponent";
const cleanEspecificCache = ({ client }) => () =>{
// What i do here?
}
const enhance = compose(
withApollo,
withHandlers({cleanEspecificCache})
)
export default enhance(MyComponent);
What i do to make it works? Thanks!
I filed a feature request for what looks like your need: https://github.com/apollographql/apollo-feature-requests/issues/29 please upvote
Use writeQuery or writeData depending on your needs.
A simple way to reset the cache for a specific query is to call the query again with fetchPolicy: 'network-only'. GraphQL fetches data from API and updates the cache after results are received.