Next.js Discord

Discord Forum

Apollo Client fetchMore does nothing

Unanswered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
Hey guys, I'm trying to get relay-style pagination working (https://www.apollographql.com/docs/react/pagination/cursor-based/#relay-style-cursor-pagination), but my fetchMore() function does nothing when i run it

<Button onClick={() => {
  if (pageInfo.hasNextPage) {
    fetchMore({
      variables: {
        cursor: pageInfo.endCursor,
      },
    })
  }
}}>{loading ? "Loading..." : "Load More"}</Button>

const cache = new InMemoryCache({
  typePolicies: {
    Query: {
      fields: {
        someQuery: relayStylePagination(),
      },
    },
  },
});

from my understanding of the documentation, if you're using relayStylePagination(), you don't need an updateQuery function in that fetchMore function?

1 Reply

TonkineseOP
Any suggestions?