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 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, possibly a tricky one but curious if this is possible.
Above is a basic snippet of what I have + concerned fields.
health
field is calculated on the fly.templates
query resolver fetches a bunch of templates from the DB and returns them.health
field inside theresolve
fn 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
health
field? I could do a simple filter on the client but preference would be to filter on the server and never return certain objects.Beta Was this translation helpful? Give feedback.
All reactions