ampp
ampp12mo ago

Is there a good example somewhere of

Is there a good example somewhere of pagination with previous/next page 1,2,3 etc?
4 Replies
trace
trace12mo ago
not completely sure if it is in that format, but got infinite scroll and load more
ampp
amppOP12mo ago
Yeah i've only seen the load more examples
trace
trace12mo ago
With some changes to the load more button example you should be able to see see your expected results tho
erquhart
erquhart12mo ago
It’s probably doable against an index that isn’t too large, the convex team can give a better idea of what that limit would be, but maybe a couple thousand records at the most? As long as an index isn’t too large, you can collect the whole index and determine what to return for a given page. Keep in mind that convex functions run close to the db to facilitate this sort of thing, so it could work fine even at scale - again, as long as the index in use is of reasonable size. With some elbow grease and creativity this could also maybe work against very large indexes, you would just likely need to keep track of some aggregates in the db to facilitate, as you’d only be able to collect a chunk at a time in the query. All of that said, would be cool for this to be better supported, maybe with .after() / .before() methods on queries.

Did you find this page helpful?