fix: pagination on connection fields#167
Merged
Conversation
…ults of resolve_field - update test suites - Add test for querying the daterangepicker
…gs _before_ the resolver is instantiated, and then use set_query_args to override some args after the resolver is instantiated. This allows for args such as `in` or `include` to be used by the ConnectionResolver in determining things like pagination and cursor slicing
…date-range-returning-error
…-on-connection-fields # Conflicts: # src/FieldType/User.php
Closed
Pull Request Test Coverage Report for Build 2c0f0fe5f254300bae53628f4fb3c652e04202b1-PR-167Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
Merged
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.
What does this implement/fix? Explain your changes.
This fixes a bug where fields that return a connection were not able to be paginated properly.
Does this close any currently open issues?
related:
Any other comments?
Using the following ACF Field Group:
acf-export-2024-02-07.json.zip
I edited a post and added several related pages as the value of the "relationship" field:
Resulting in the following IDs being stored:
[17,105,106,15,16,18,19,20,21,22,23,24,7,25,26,27,28,29,30,31]I then queried for the relationship field and tried to paginate:
BEFORE 🚫
Querying page 1 looks correct. I ask for the first 3 items and get them:
17, 105, 106But using the
endCursoras the value for the$aftercursor, I do not get the expected results.Expect:
15, 16, 18Actual:
15andhasNextPage: false😱 😭 🤯 🤔AFTER ✅
Querying page 1 looks correct. I ask for the first 3 items and get them:
17, 105, 106Using the
endCursoras the value for the$aftercursor, I also get the expected results.Expect:
15, 16, 18Actual:
15, 16, 18And I can continue to paginate with the end cursor until the results run out and
hasNextPagereturns false as expected.i.e. here's the last page of results with records
30, 31andhasNextPage: false