Struggling to return a list of items from cache from a different query root #1917
Unanswered
adam-thomas-privitar
asked this question in
Q&A
Replies: 1 comment
-
I think the issue is the same as these: In which case, I'm going to hack around it by iterating the private cache manually for now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I feel like my use case might be more obvious than I think, but I'm really struggling to wrap my head around the docs. This is my last of throw of the dice. Any help much appreciated.
What im trying to do is to make it so a query, lets call it Query B, returns the known items which have previously been fetched into my graphcache by Query A. I believe since I accessed these deep items differently in Query A and Query B, I need to hint with my own resolvers. However, in the docs, I cant see a way in which I can fetch all records of a given type and return them where I need.
Query A
This query is made before query B, and basically its the "tags" im interested in. I'll comment in the query the typename for clarity.
Query B
This is a query which now fetches a list of tags. I'd like it to returns the
Tags
which have already been retrieved as part of the above entity.So essentially, I now need query B to get all the
Tag
s already populated into the denormalised cache by QueryA, but wrapped in this outer structure (nodes/edges).This is where my struggles begin. I have proven to myself I can return what I want for the
tags
query root by adding something dumb like this:But how can I use
cache
to return an array of all knownTag
s in the cache, so I can return them all here?As youve probably realised, I'm going to use relay style pagination. Im yet to load the graphcache extension for that -- and I dont know if that affects the answer to my problem.
Beta Was this translation helpful? Give feedback.
All reactions