Skip to content

How do I get the original returned object in a resolver? #1231

Answered by kitten
Svarto asked this question in Q&A
Discussion options

You must be logged in to vote

The docs do mention this around here: https://formidable.com/open-source/urql/docs/graphcache/computed-queries/#resolve
I haven't quite looked at the specific line to link to but the tl;dr is that parent is only the object as it's been assembled to from previous fields. So you don't want to use it directly most of the time. The explanation for that is simple: Any entity has a potential countless number of fields, some even taking arguments. The cache structure is an implementation detail so it's not possible to return all that the cache has in a meaningful form.

Do you have some details on what you're trying to achieve? I see that you want to basically write cache.resolve(parent, 'recipe_…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Svarto
Comment options

@JoviDeCroock
Comment options

@kitten
Comment options

@Svarto
Comment options

Answer selected by Svarto
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants