You are reading content from Scuttlebutt
@Hendrik Peter %ktZaxpB0nrzJH1qvZjOZ4h10dM4lBNP4nT5GJAtPV7I=.sha256
Re: %TpL9URpcp

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!

Join Scuttlebutt now