0
私はsongs
のルートクエリを持っています。これはページ区切りコンテナにあります。 その後、comments
という名前の曲にネストされたプロパティがあるので、一度に各曲に10k個のコメントをロードしたくないため、改ページしたいと思っています。リレー最近の入れ子になったページネーション
songsContainer.js:
fragment songsContainer on Query {
songs(
first: $count
after: $cursor
genre: $genre
filter: $filter
) @connection(key: "songsContainer_songs") {
edges {
node {
audioId
name
coverImageUrl
artist
likes
dislikes
...commentsContainer
}
}
}
}
const connectionConfig = {
direction: 'forward',
query: graphql`
query songsContainerForwardQuery(
$count: Int!
$cursor: String
$genre: String
$filter: FilterInput
) {
...songsContainer
}
`,
getVariables: (_, { count, cursor }) => ({
count,
cursor,
}),
};
paginationContainer(fragments, connectionConfig);
commentsContainer.js私はコメントをconnectionConfigを書くにはどうすればよい
fragment commentsContainer on Audio {
comments(
first: $count
after: $cursor
getReplies: $getReplies
) @connection(key: "commentsContainer_comments") {
edges {
node {
commentId
body
date
likes
dislikes
repliesCount
originalComment {
id
}
user {
userName
}
}
}
}
}
?私はこれを試した:
しかし、コメントは、曲にネストされているため、クエリがルート上に存在しないというエラーをスローします。