title: Nested query cache redirects in Apollo
body: <p>I've got a question about <code>cacheRedirects</code> in Apollo, I've got an overview of items and a detailview. I'd like the detailview cache to be redirected to an item from the overview (like <a href="https://www.apollographql.com/docs/react/advanced/caching.html#cacheRedirect" rel="nofollow noreferrer">the book example</a> in the docs). </p>
  
  <p>The only thing is that the thing I'd like to redirect to can only be queried from inside a bigger parent query.</p>
  
  <p>So expanding the books example it'd be like:</p>
  
  <pre><code># for all books
  library (id: ID) {
      books (params) {
          id
          title
      }
  }
  
  # for a single book
  library (id: ID) {
      book (id: ID) {
          id
          title
      }
  }
  </code></pre>
  
  <p>What would I redirect to if I'd like to fetch a single book?</p>
  
  <p>I don't think I could do this, because I'm actually fetching a library in order to fetch a book:</p>
  
  <pre><code>cacheRedirects: {
      Query: {
          book: () =&gt; {
              // return book id from cache
          }
      }
  }
  </code></pre>
  
  <p>Is there a way to redirect a query for a book (through a <code>library</code>) to the data for a book? Or am I thinking about this in the wrong way?</p>