Closed mansrz closed 3 years ago
@mansrz why did you close this? Did you find a solution? I am getting the same issue with the following query
query MyQuery { wagtail { pages { ... on NewsPage { id intro title } } } }
I realise that this could be fixed on the client side however, it defeats the purpose of GraphQL if we are forced to process unnecessary data.
Can we reopen this?
I would believe that it should be opened, I closed it because I "solved it" at the moment doing the query by id but isn't the correct solution
I can see how confusing this could be...
What do you think of the following @SamuelTaylor001:
page (contentType: "blogs.BlogPage") {
... on BlogPage {
title
}
}
will return the first result based on that contentType and will be the equivalent of the following ORM query: BlogPage.objects.first()
I've added a PR for a solution that uses the pageType
— I think contentType
is something slightly different.
I am also filtering out the application prefix (i.e. the 'blog.' part of 'blog.BlogPage') to match the declared pageType
returned in a query, but wonder if this isn't going to cause problems if two apps have the same model name.
The reason the { page(contentType:"home.AboutPage"){ ... on AboutPage { contentType id } }
query fails is that the content type filter only kicks in if there is a preview token - https://github.com/GrappleGQL/wagtail-grapple/blob/master/grapple/types/pages.py#L197-L209
@isolationism thank you for #144 -- I think we should stick to content type as a filter to avoid namespace clashes.
Will open a new PR to fix the filter on content type (an credit you on it as well, @isolationism )
https://github.com/GrappleGQL/wagtail-grapple/pull/147
all reviews are welcome
Hi, thanks for help me with last problem Now, i don't know if it is a bug or concept error mine, but if you can help me please can be help for other
I tried to get a page specific with filter by contenttype but i got null response, so i have to query "pages" instead "page" and can't filter by contenttype this cause me get many "{}"
Example query:
{ page(contentType:"home.AboutPage"){ ... on AboutPage { contentType id } }