usePaginatedLoadAll hook automatically fetches all pages of a paginated query and returns the complete result set.
Import
Signature
paginated-query.hook.ts:100-169
Parameters
A GraphQL query created with the
graphql tagged template. The query must return a paginated result with nodes and pageInfo fields.Configuration options for the query.
Return Value
Array of all items fetched from all pages.
True while pages are being fetched.
Function to refetch all pages with optional new variables.
Example
How It Works
The hook automatically:- Fetches the first page (100 items)
- Checks if there are more pages via
pageInfo.hasNextPage - Continues fetching subsequent pages using the
endCursor - Aggregates all results into a single array
- Calls
onResultscallback when complete
Performance Considerations
For large datasets, consider:- Using usePaginatedQuery for manual pagination
- Implementing virtual scrolling with incremental loading
- Adding filters to reduce the total result size
Error Handling
The hook throws errors that occur during fetching. Wrap components using this hook with an Error Boundary:Internal Usage
This hook is used internally by:- useTournamentTeams - To fetch all teams in a tournament
- useTournamentStep - To fetch all match scores
See Also
- usePaginatedQuery - Manual pagination control
- Error Handling Guide - Pagination error patterns