Repository navigation
Support pagination with unlimited results - #2781
Open
williamjallen wants to merge 5 commits into
Open
williamjallen wants to merge 5 commits into
williamjallen wants to merge 5 commits into
Conversation
williamjallen
force-pushed
the
connection-null-limit
branch
from
July 15, 2026 14:54
68f88f6 to
31413c0
Compare
Author
|
@spawnia Any chance you could take a quick look at this? |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unlimited pagination currently bypasses maximum limits and mishandles some pagination metadata and nested relationships.
4 open findings
What changed in this PR
Enables unlimited pagination when first is omitted or null.
Changes:
- Makes
firstnullable. - Fetches complete result sets for root and nested relations.
- Adds pagination tests for unlimited results.
| File | Description |
|---|---|
src/Pagination/PaginationArgs.php |
Handles nullable limits and unlimited fetching. |
src/Pagination/PaginationManipulator.php |
Makes generated first arguments nullable. |
src/Execution/ModelsLoader/PaginatedModelsLoader.php |
Supports unlimited nested relationships. |
tests/Unit/Pagination/PaginateDirectiveTest.php |
Updates nullable argument tests. |
tests/Integration/Pagination/PaginateDirectiveDBTest.php |
Tests unlimited pagination variants. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
williamjallen
force-pushed
the
connection-null-limit
branch
from
October 11, 2026 18:04
31413c0 to
9143c8d
Compare
Comment on lines
+125
to
+126
| if (! $this->decorationDependsOnParent) { | ||
| return [array_values($parents->all())]; |
# Conflicts: # src/Execution/ModelsLoader/PaginatedModelsLoader.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Resolves #2734
Changes
Adds the option
allowUnlimitedto@paginateand the paginated relation directives, and the configuration optionpagination.allow_unlimited.Fields that opt in generate
first: Intinstead offirst: Int!, andfirst: nullreturns all items on a single page.Nested relations then load the items of all parents with a single
whereInquery and no count query, the same query as a non-paginated@hasMany.The current workaround of passing a large
firstruns a count query plus aUNION ALLwith one subquery per parent.In a local benchmark with 100 parents and 2,000 children, database time went from ~75 ms to ~2 ms.
Builder directives that depend on the parent model (#2671) still get one subquery per parent.
Parents are grouped by the SQL and bindings of their decorated relation query, and only fields with field builder directives are compared.
Each subquery of the resulting
UNION ALLgets a very largeLIMIT, because MySQL ignores theORDER BYof subqueries without one.allowUnlimitedrequires that no maximum count applies.Combining it with
maxCountthrows aDefinitionExceptionwhen building the schema.If
max_countis configured after the schema was cached,first: nullis rejected at runtime as well.Breaking changes
None, fields keep generating
first: Int!unless they opt in.Changelog
Added
allowUnlimitedto@paginateand paginated relation directives and configuration optionpagination.allow_unlimitedto fetch all items withfirst: null