GraphQl查询相同的集合
我在GraphQL中有一个过滤的查询,该查询仅返回一些特定的内容,而我想添加相同的查询,但要显示所有IT内容。我不能在同一页面中使用两个类似的查询,最终我也无法传递我想要的所有数据,即使我在组件中添加了此查询,也会导致未定义的错误。 这是查询:
allPrismicCollection(
sort: {fields: data___collection___text, order: ASC}
limit: $limit
skip: $skip
) {
nodes {
data {
slides {
slide {
document {
... on PrismicSlide {
data {
blogs {
blog {
document {
... on PrismicBlog {
uid
data {
image {
gatsbyImageData(aspectRatio: 1.5)
}
}
}
}
}
}
}
}
}
}
}
}
}
}
这也是我要添加的查询:
allPrismicCollection {
nodes {
data {
collection {
text
}
slides {
slide {
document {
... on PrismicSlide {
id
data {
blogs {
blog {
document {
... on PrismicBlog {
id
data {
tags {
tag
}
}
}
}
}
}
}
}
}
}
}
}
}
}
任何想法如何混合这些查询,或者可能在组件中独立添加?! 谢谢。
I have a filtered query in GraphQL that return only some specific content , while I want to add this same query but to display all it content . I cannot use two similar queries in the same page , eventually I cannot pass this all data that I want , even if I add this query in a component it will cause an error of undefined .
This is the query :
allPrismicCollection(
sort: {fields: data___collection___text, order: ASC}
limit: $limit
skip: $skip
) {
nodes {
data {
slides {
slide {
document {
... on PrismicSlide {
data {
blogs {
blog {
document {
... on PrismicBlog {
uid
data {
image {
gatsbyImageData(aspectRatio: 1.5)
}
}
}
}
}
}
}
}
}
}
}
}
}
}
and this is the query I want to add as well :
allPrismicCollection {
nodes {
data {
collection {
text
}
slides {
slide {
document {
... on PrismicSlide {
id
data {
blogs {
blog {
document {
... on PrismicBlog {
id
data {
tags {
tag
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Any idea how to mix these queries , or maybe to add it independently in components ?!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您别名它们。如:
每个特定查询的结果,而不是在
props.data.allprismcollection
中,将在props.data.result1
和props.data.result2
分别。You can as long as you alias them. Like:
The result of each specific query, instead of being inside
props.data.allPrismicCollection
will be inside ofprops.data.result1
andprops.data.result2
respectively.