Resolver example: Cursor based pagination (e.g. endless scrolling) #2555
Svarto
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I looked around and couldn't find an example of using cursor based pagination with URQL and resolver. The provided resolvers include simplePagination (offset based) and relayPagination (relay scheme based), and have pro's and con's. Further, the docs even say that these are "quick" resolvers to plug in, but for more robust pagination we are asked to code our own.
I struggled a lot pulling together a cursor based pagination, in my case based on date, e.g. "created_at", so want to showcase how I finally managed to do it AND hopefully get some nice feedback to further improve it. So far, it only handles date based cursors, e.g.
created_at
orupdated_at
.My resolvers is HEAVILY based on the simplePagination one, so all credit goes to the URQL team to provide such an awesome library and open source it!!
cursorPagintation.js:
Beta Was this translation helpful? Give feedback.
All reactions