URQL - interface resolvers in graphcache #1624
-
Hi all, needing some beginner help here, I understand to relate a query to an entity in graphcache it can be done simply like so:
How can you create the same relationship with a query to an interface type which can return potentially multiple different typenames? e.g.: say I had an Animal interface and wanted the cache to lookup multiple typenames here:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think you'd be best off checking whether |
Beta Was this translation helpful? Give feedback.
I think you'd be best off checking whether
cache.resolve({ __typename: 'Dog', id }, 'id') || cache.resolve({ __typename: 'cat', id }, 'id')
returns a field and use that. Thecache
is the thirth parameter of your function there.