Replies: 2 comments 14 replies
-
I understand where this is coming from, for sure. My current worry about this is that some sites would get hundreds of extra queries. Maybe the solution would be to hide queries that return a single type behind a configuration option? I'll bring this up internally and we'll talk about it. I should get back to you by the end of the week about this. |
Beta Was this translation helpful? Give feedback.
-
Hi @andris-sevcenko. There's another point I want to add and which relates to my initial query. I've created a field where I can choose an entry, but with just a single entry type: But if I want to query this with Graphql, the Schema does not know that this can be only one type: It would be great if the only possible entry type for |
Beta Was this translation helpful? Give feedback.
-
We're using Craft CMS as a headless CMS for a Next.js frontend. We're also using
graphql-coden
to create typed hooks for our Graphql queries. But sinceentries
could be any entryType, a query likewould result in
entries: Array<{ id: string } : {}>
, because we have a lot of other entry types:For sure we can use a section filter to get only results with the
homepage
entryType, but the codegen does not know that this filter is going to return one (or more) specific type(s) only.Now writing a typed frontend becomes a mess, since we have to double check the typenames everywhere and extract the right types from huge unions. It would be nice if we could have something like:
typedEntries
may not be the best name, but I think you know what I mean 😄 Is this something that you may can think of? Or should I add such root nodes by myself?Beta Was this translation helpful? Give feedback.
All reactions