Skip to content

Is there any way to eliminate the objectType's resolve process? #886

Answered by colin-oos
toriiico asked this question in Q&A
Discussion options

You must be logged in to vote

This sort of defeats the purpose of GraphQL which, by design, is intended to save resources by only fetching what it needs based on the front-end's field selection. Though I understand the unique issue you are trying to solve. You can remove the Error: 'resolve' is declared here. errors by defining a sourceType for User and declare company as a direct property on the source type. Then Nexus will know to expect the property on the source type that gets returned by the root resolver.

However, I don't recommend doing that since again it defeats one of the key advantages to GraphQL. Instead, you should only return each level at a time in each resolver rather than returning sub-levels within a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@toriiico
Comment options

Answer selected by toriiico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants