-
Notifications
You must be signed in to change notification settings - Fork 1.4k
How to get parent resolved object in deeply nested resolver? #1244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TL;DR: parent_ctx = ctx.parent
parent_obj = parent_ctx.object
# => company
|
@rmosolgo How can one access the parent object in the new class-based API? |
@rmosolgo Never mind, found my answer in #881 (comment), thanks! |
1.9.17 will introduce "scoped" context, a part of context which is added for child fields only #2634 You could |
Awesome, thank you! |
@rmosolgo Scoped context is marked as |
Sorry, it really shouldn't be marked |
Uh oh!
There was an error while loading. Please reload this page.
I have a query like:
The
company
resolver looks something like:Because it's a child of the
:user
field directly, it can access the resolved user (which is good, but...)The
userProfile
resolver also needs the user model.obj
in this second resolver is thecompany
, which won't have a reference to the user.ctx.ast_node
seems to have no way to walk up to the parent (there's no.parent
method) so I'm not sure how to use a higher resolved obj in a lower resolver?The text was updated successfully, but these errors were encountered: