You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use LIMIT / OFFSET using the first / after arguments for simple pagination, but it's not currently possible with mariadb. Currently, 'after' accepts only a string cursor, but it should also accept an integer for SQL offset.
The text was updated successfully, but these errors were encountered:
The Relay Cursor contains the offset and is therefore predictable. You can produce the cursor for any row in the middle because you can predict the offset value. graphql-relay has a helper for this. (..)
What's really going on with after and the cursor (if I've got the pagination docs right), when you use sqlPaginate: true, is just a simple limit / offset with a base64 encoded cursor as graphql-relay specificates.
You should not worry about it being a string, since:
The cursor will be provided to you by the endCursor field in pageInfo; just add it to the query to get it out (so when you paginate you can just use it in the following query)
The cursor is just an encoding, and as the example in the docs shows, you can determinate it given an offset usinggraphql-relay function offsetToCursor:
import{offsetToCursor}from'graphql-relay'letcursor=offsetToCursor(9)// jump straight to page 3!letquery=`{ user(id: 1) { posts(first: 5, after: "${cursor}") { pageInfo { endCursor } total edges { node { body } } } }}`
I tried to use LIMIT / OFFSET using the first / after arguments for simple pagination, but it's not currently possible with mariadb. Currently, 'after' accepts only a string cursor, but it should also accept an integer for SQL offset.
The text was updated successfully, but these errors were encountered: