with the code provided above I was able to get "pagination" to work too. It took some time until the dots connected in my head (the value of the endCursor
can be used post(before: "HERE")
) but then getting pagination to work was quite easy.
Crude sketch of my query (there's probably a cleaner way to insert things)
function fetchLatestMessages(cursor) {
const before = cursor ? `, before: "${cursor}"` : '';
return apolloClient
.query({
query: gql`
{
posts(last: 100, orderBy: ASSERTED${before}) {
pageInfo {
endCursor
hasNextPage
},
edges {
node {
id,
author {
name,
id
},
likesCount,
text,
assertedTimestamp,
rootKey
}
}
}
}
`,
})
thanks for the samples and the AWESOME sidebar documentation on localhost:8080!