Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

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

Open
AGurindapalli opened this issue Jan 28, 2019 · 1 comment
Open

Comments

@AGurindapalli
Copy link

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

@RealSilo
Copy link

RealSilo commented Feb 7, 2019

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 });
......

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants