次のスキーマがあります
User {
username: String!
name: String!
posts(page: Int!): [Post]
}
Post {
title: String!
description: String
}
そしてクエリで
type Query {
user(username: String!): User
}
Query -> user
私が定義したリゾルバーとuser -> posts
、使用するデータをプルするとき:
{
user(username: 'pewpewlasers'){
username
name
posts(page: 1){
title
description
}
}
}
それはうまくいっています。ここで私の質問は、無限スクロールの状況で 2 ページ目を効率的にプルする方法です (最後に [さらに読み込む] ボタンを使用)。私は使用できます:
{
user(username: 'pewpewlasers'){
username
name
posts(page: 2){
title
description
}
}
}
しかし、ユーザーを再度引っ張る必要はないようです。もっとロードするための投稿が必要です。これをgraphqlが処理する組み込みの方法はありますか? posts(page: Int!, username: String!)
または、別のクエリを定義する必要がありますか