Why does offsetForArgs add 1 to after?
#943
danieljvdm
started this conversation in
General
Replies: 1 comment 2 replies
-
|
Thanks for the question! Basically the way this works is if you have a response like: {
someConnection: {
pageInfo: {
hasPreviousPage: false,
hasNextPage: true,
startCursor: 'offset:0',
endCursor: 'offset:2',
},
edges: [
{
cursor: 'offset:0',
node: {
id: '1',
},
},
{
cursor: 'offset:1',
node: {
id: '2',
},
},
{
cursor: 'offset:2',
node: {
id: '3',
},
},
],
},
};The query for the next page would look something like: query {
someConnection(after: "offset:2", first: 3) {
...
}
}Based on your question, I think the important thing to remember is the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/hayes/pothos/blob/main/packages/plugin-relay/src/utils/connections.ts#L62
I don't understand why 1 is added here. If I have a B64 string that converts to
After:20, I want my SQL query to beOFFSET 20, notOFFSET 21, otherwise I'm skipping a row.GraphQL Relay JS doesn't do this: https://github.com/graphql/graphql-relay-js/blob/main/src/connection/arrayConnection.ts#L136C1-L141C2
What am I missing here?
Beta Was this translation helpful? Give feedback.
All reactions