So if I have to run 10 queries, should I expect to...
# prisma-whats-new
c
So if I have to run 10 queries, should I expect to see
Apollo(Apollo(Apollo(Apollo(Apollo(Apollo(Apollo(Apollo(Apollo(Apollo(...)))))))))
?? 😆 although that makes sense to me how that could happen with the function composition, I hope I'm doing something wrong
d
As @cnickeson mentioned elsewhere, you should usually be able to get the data you need with a single graohQL query, by traversing your nodes. If that is not possible, I would usually separate the concerns into multiple container components to keep each of them as simple as possible.
For your use case, you can use a single query to get all of the enum values that you need:
query{ Enum1: __type(name:"Enum1"){ name enumValues{ name } } Enum2: __type(name:"Enum2"){ name enumValues{ name } } }
c
Thanks @dankent, that makes sense. I thought the point of Apollo /
compose()
was that it would do that type of batching for me, instead of me writing the queries manually combined. Is there some other method to do that?
d
I would probably make a function that takes an array of enum names and generates the query