title: How to handle cache update after mutation in multiple views?
body: <p>This is more of a open question but hopefully it won’t get deleted.</p>
  <p>I am using react and apollo although the question is more general.</p>
  <p>Let’s say I have 3 distinct views in my app all using similar (but not the same) data.
  All of them are using separate queries but each of the query uses common operation but with slightly different data returned.</p>
  <p>Let’s say I have a mutation somewhere that adds something to data (think of a list of items and a new item being added).</p>
  <p>Let’s say after mutation I want to update cache to reflect that change. I am using read/writeQuery to do the update.
  With this setup I need to update 3 queries - this becomes a maintenance nightmare.</p>
  <p>After some reading I figured I am doing this wrong - I have now created a single query - now I need to only update that single query after mutation and all of my views are updated automatically.
  However the problem is that this query now has to download all the data that all 3 views combined need - feels like this is very inefficient, because some of the views will get data they'll never use.</p>
  <p>Is there a better way to do it?</p>
  <p>Please note that <code>read/writeFragment</code> won't work because they won't update the underlying queries - check this answer for example: <a href="https://stackoverflow.com/a/50349323/2874705">https://stackoverflow.com/a/50349323/2874705</a></p>
  <p>Please let me know in comment if you need a more concrete example.</p>
  <p>All in all I think in this setup I would just be better with a global state handling and avoid apollo cache all together - however I feel cheated cause apollo promised to solve the state problems :)</p>
  <p>EDIT</p>
  <p>Here's a concerete example:</p>
  <p>Let's say our graphql schema is defined liked this:</p>
  <pre><code>type Post {
      id: ID!
      title: String!
      body: String
      published: Boolean!
  
  }
  
  type Query {
      posts(published: Boolean): [Post!]!
  }
  
  
  type Mutation {
    createDraft(body: String!, title: String!): Post
    publish(id: Int!): Post
  }
  </code></pre>
  <p>Now, we create 3 queries and 2 mutations on the client</p>
  <pre><code>query PostTitles {
      posts {
          id
          title
      }
  }
  
  query Posts {
      posts {
          id
          title
          body
          published
      }
  }
  
  query PublishedPosts {
      posts (published: true) {
          id
          title
          body
          published
      }
  }
  
  mutation CreateDraftPost ($body: String!, $title: String!) {
      createDraft(body: $body, title: $title) {
          id
          title
          body
          published
      }
  }
  
  mutation PublishPost ($id:ID!) {
      publish (id: $id) {
          id
          published
      }
  }
  </code></pre>
  <p>Just to note <code>createDraft</code> creates a post with the default <code>false</code> <code>published</code> value.</p>
  <p>How can use either of those mutations to create or publish a post and have all the 3 cached queries to be updated without using <code>refetchQueries</code> or manualy updating each of the query?
  I think the real problem is that each of those queries are stored separately in the apollo in-memory cache.</p>