I have a lot of active queries stored in my Apollo Cache, for example:
items(isPublished: true, orderBy: "name", filterByName: "")
items(isPublished: true, orderBy: "name", filterByName: "home")
items(isPublished: false, orderBy: "name", filterByName: "home")
items(isPublished: true, orderBy: "age", filterByName: "home")
...
and, consequently, a lot of possible variables for the same query (GET_ITEMS), with more and more filters. When I want to add, move or remove an item, I update the Apollo Cache with the propery update of Mutation component, for example:
import gql from "graphql-tag";
import { Mutation } from "react-apollo";
const ADD_ITEM = gql`
mutation AddItem(...
`;
...
<Mutation mutation={ADD_ITEM} variables={...} update={() => ...} />
But, if I want well updated all my cached queries ... how I accomplish this? Would I have to cache.readQuery and cache.writeQuery inside update function for each query? That would be madness for me.
I'm lost with this. Thanks in advance.