Let's think through the problem one more time:
- We have some information about a repository in a cache that includes the number of stars it has.
- When we star the repository, we want to see that the number of stars has been incremented by one.
- What if we could just increment the number of stars in the cache by one? This should hopefully resolve the problem.
So, let's give this a go and update the cache after the mutation has finished:
- First, let's remove the refetchQueries prop we implemented in the last section.
- There is an update prop on the Mutation component that we can leverage to update the cache. So, let's start to implement this:
<Mutation mutation={STAR_REPO} update={cache => { // Get the cached ...