API Reference
useConvexPaginatedQuery
Reference for the client-only paginated query composable.
useConvexPaginatedQuery subscribes to paginated Convex query results and manages page accumulation on the client.
Import
Nuxt
const { data, loadMore } = useConvexPaginatedQuery(api.tasks.paginated, {}, { numItems: 20 })
Vue
import { useConvexPaginatedQuery } from 'vue-convex'
Signature
function useConvexPaginatedQuery<Query extends FunctionReference<'query'>>(
query: Query,
args: MaybeRefOrGetter<Omit<FunctionArgs<Query>, 'paginationOpts'> | 'skip'>,
options: {
numItems: number
},
): {
suspense: () => Promise<unknown[][]>
pages: ComputedRef<unknown[][]>
data: ComputedRef<unknown[]>
lastPage: ComputedRef<PaginationResult<unknown> | undefined>
error: Readonly<Ref<Error | null>>
isDone: Readonly<Ref<boolean>>
isPending: ComputedRef<boolean>
isSkipped: ComputedRef<boolean>
isLoadingMore: Readonly<Ref<boolean>>
loadMore: () => void
reset: () => void
}
Parameters
| Parameter | Type | Meaning |
|---|---|---|
query | FunctionReference<'query'> | Generated paginated query reference |
args | Omit<FunctionArgs<Query>, 'paginationOpts'> | 'skip' | Query args without paginationOpts, or "skip" |
options.numItems | number | Page size for each request |
Return value
| Field | Meaning |
|---|---|
pages | Loaded results grouped by page |
data | Flattened items from all loaded pages |
lastPage | Raw most recent pagination result |
isDone | true when there are no more pages |
isLoadingMore | true while a later page is loading |
loadMore | Requests the next page |
reset | Clears the current pages and restarts from page one |
Behavior
- Client-only; no SSR prefetch path
- Re-subscribes and resets automatically when reactive args change
- Clears all pages when
argsbecomes"skip"