Dynamic Pagination
Essential knowledgeCore knowledge to understand Fluent Commerce
Intended Audience:
Technical User
Author:
Kirill Gaiduk
Changed on:
24 June 2025
Overview
`DynamicConnectionQuery` automatically derives the Connection fields (arrays) for the primary Entity based on the `RulesetContext` and can dynamically load all connection items, with pagination handled internally.Key points
- Automatic Pagination:
`DynamicUtils.queryList`completely automates fetching paginated data from a GraphQL connection. You get a simple`Iterable`, and the library handles fetching subsequent pages in the background as you iterate. - Lazy Loading: The utility is highly efficient because it uses a "lazy loading" approach. It only fetches the next page of data when you have iterated through the current one.
- POJO-Driven: You define the data you need by creating a simple POJO class. The utility dynamically builds the GraphQL query to fetch only the fields defined in your POJO.
- Server-Side Filtering: You can pass a
`Map`of parameters to`queryList`to filter the connection on the server. This is much more efficient than fetching all the data and filtering it in your rule.
Here is a collection of common scenarios for the Dynamic Pagination usage:
Query from Context usage
The simplest approach is to let the system automatically select the appropriate GraphQL query based on the entity type from the`RulesetContext`.