Access a specific cached type by id? #1489
-
I'm in a position where I want to retrieve a specific (cached) object type by it's id. Assuming the type is available in the cache I suspect this must be possible, though have no idea how. I have been playing around with this; but that doesn't seem fruitful; const client = useClient()
const q = gql`fragment _ on SomeType {
id
field1
field2
}`;
console.log(q)
const result = client.readQuery(
q,
{
id: "..."
}
)
console.log(result) Any ideas? Is this possible at all? |
Beta Was this translation helpful? Give feedback.
Answered by
JoviDeCroock
Mar 30, 2021
Replies: 1 comment 3 replies
-
I think you're looking for https://formidable.com/open-source/urql/docs/graphcache/local-resolvers/#reading-a-fragment |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
corstian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you're looking for https://formidable.com/open-source/urql/docs/graphcache/local-resolvers/#reading-a-fragment