#Multiple paginate calls in a single query

3 messages · Page 1 of 1 (latest)

somber hedge
#

@barren moat what happens if my paginated query has multiple calls to ctx.db.query().paginate()? Is that supported?

barren moatBOT
#

Let me check the knowledge base for you. One moment! :books:

#

No, multiple calls to ctx.db.query().paginate() within the same query are not currently supported in Convex. As per the discussions in the Discord support threads, you can only have one paginated database call per query. The cursors aren't interchangeable between ctx.db.query calls. If you need to paginate over multiple sets of data, you would need to implement separate paginated queries for each set.

However, if you want to paginate the union of multiple sets of data, you can do it with two separate usePaginatedQuery hooks from the client, but if you want to do it with a single query it's not possible today. Multiple paginate calls in a query is something that could potentially be supported in the future, but there's no timeline yet.

For more details, you can refer to these discussions:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: