0
루트 쿼리가 songs
입니다.이 페이지 매김 컨테이너에 있습니다. 그런 다음 comments
이라는 노래에 중첩 된 속성이 있으므로 한 번에 각 노래에 대해 10k 개의 의견을로드하고 싶지 않기 때문에 페이지 매김을하고 싶습니다.중계 현대 중첩 페이지 매김
songsContainer.js :
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
}
}
}
}
}
가 어떻게 의견의 connectionConfig을 쓰는가
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
? 나는 이것을 시도 :const connectionConfig = {
direction: 'forward',
query: graphql`
query commentsContainerForwardQuery(
$count: Int!
$cursor: String
) {
...commentsContainer
}
`,
getVariables: (_, { count, cursor }) => ({
count,
cursor,
}),
};
그러나 의견이 노래에 중첩되어 있기 때문에 쿼리가 루트에 존재하지 않는다는 오류가 발생합니다.