Help setting up paginated results from data query v2 (graphql)

I’m trying to set up a paginated results section using the revamped data query integration (graphql).

With the legacy data query integration, I was able to set a previous and next button to onClick change the results shown (increment/decrement $state.p and use as a variable in the query’s offset/skip and limit/first).

However, when using the new data query integration, this method doesn’t seem to change the shown results to the next 6 cards, for example.

What am I doing wrong, or is there a better way to show paginated results from a graphql query?

Relevant links:

Sorry for the late reply! The issue is in Variable overrides, you should return the object without JSON.stringify, e.g.

return {
  limit: cards,
  offset: (p - 1) * cards
}

Currently the string is being spread into variables as characters.

1 Like