Skip to content

Support findMany offset via cursor pagination - #406

Draft
MauruschatM wants to merge 1 commit into
get-convex:mainfrom
neunzig-zehn:feat/findmany-offset
Draft

Support findMany offset via cursor pagination#406
MauruschatM wants to merge 1 commit into
get-convex:mainfrom
neunzig-zehn:feat/findmany-offset

Conversation

@MauruschatM

Copy link
Copy Markdown

Motivation

findMany throws offset not supported, but some Better Auth surfaces pass offset — e.g. the dashboard's table paging. This PR supports it and re-enables the five upstream offset tests in @better-auth/test-utils.

Changes

The component paginates by cursor and stays cursor-only. The client fetches offset + limit rows through the existing cursor pagination and drops the first offset rows; offset is stripped from the component query args.

Cost

  • offset + limit reads exactly offset + limit rows — deep offsets cost proportionally, the same as any cursor-based store emulating offset. This is aimed at admin-style paging.
  • offset without limit can't be rejected (three of the four upstream offset tests pass offset with no limit), but it's cost-equivalent to the already-supported no-limit findMany, which pages 200 rows at a time to the end — no new unboundedness is introduced.

Tests

  • Re-enabled the upstream offset tests. The three sortBy and offset variants mutate runtime schema (numericField additional field), so they follow the existing pattern: added to ADDITIONAL_FIELDS_NORMAL_TESTS and run in the additional-fields profile, which has the static field + index.
  • New convex-custom test: offset applied to OR unions.

npm run build, npm run typecheck (src), and the full vitest suite pass: 10 files, 188 passed | 26 skipped (main baseline: 182 passed | 31 skipped).

Note: this touches the same findMany region as #404; whichever merges second will be rebased promptly.

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@MauruschatM is attempting to deploy a commit to the Convex Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant