Filter based on resolved field on a prismaNode
#1156
Replies: 1 comment 1 reply
|
No, that's not possible. There is no way to resolve a child field before a parent is fully resolved. This just doesn't make sense, you have a health field for each template, and your resolver is passed the template as the parent object even if you don't use it. You need to fetch your list of templates before fetching your templates. If you don't need the template to determine health, you can extract the logic and re-use it in the query resolver instead |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey, possibly a tricky one but curious if this is possible.
Above is a basic snippet of what I have + concerned fields.
healthfield is calculated on the fly.templatesquery resolver fetches a bunch of templates from the DB and returns them.healthfield inside theresolvefn for the query.Is there a way to tell Pothos not to return a particular template in the response based on the value of the
healthfield? I could do a simple filter on the client but preference would be to filter on the server and never return certain objects.All reactions