apollographql/apollo-link-state

How to read Data one object from array of objects from cache.

Opened this issue · 1 comments

How to read S1 from the from the cache?
I have stored the data in cache like this.

cache

Here is my Apollo-Client
ap_client

If i'm reading using Fragment's like below i'm getting data as null

c

You have to use the query within the function instead of the getCacheKey.

const storyQuery = gql`
  query {
    story @client {
      storyKey1
      storyKey2
    }
  }
`;

const { story } = cache.readQuery({ query: storyQuery });
......