-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(graphql): remove count query if paginationInfo is not requested #6068
Conversation
I think this would fix api-platform/api-platform#2310 api-platform/api-platform#1996 and #4764 (after full implementation) |
I like this approach, can you add a test? |
6690814
to
03791fe
Compare
03791fe
to
f0f873a
Compare
@soyuka sure, I think this should do the trick, WDYT ? |
Thanks for your feedback @alanpoulain I think to control partial pagination in "paged" pagination in graphql, it would make sense to offer a I think this should be done only with a new interface So we will have the following
Each item may trigger one query to response, only if declared in the client query. So in the case described in the current issue, no additionnal query would be triggerred:
If paginationInfo.totalCount or paginationInfo.lastPage is declared, the count query would be issued. If |
Sure why not, maybe this interface could be used for REST as well. IMO it should be done in another PR though. |
3f0e17f
to
211a0b5
Compare
I'll go with another PR for that part ^^ On the main topic of this pull request, beside the falling test (because of php-parser 5.0.0), I think we're good to go. @alanpoulain may you take a look please ? |
211a0b5
to
fbdc798
Compare
53a8989
to
379cf2e
Compare
Hi @soyuka @alanpoulain do you have a new feedback on this pull request ? Maybe something I should improve before merging it ? Thanks ! |
can you rebase against 3.2 so we get proper coverage? |
379cf2e
to
5144e62
Compare
@soyuka It seems that coverage is ok after rebase 👍 |
Thanks @xavierleune ! |
@alanpoulain following this pull request, I opened the PR #6120 about the hasNextPagePaginatorInterface |
This pull request is a draft to fix a bug discovered on the current graphql implementation.
If the following request is sent:
The current implementation executes the count query on the database, to populate
paginationInfo
in the result until this information is dropped by the methodReferenceExecutor::collectAndExecuteSubFields
.I would expect the count query to be executed only if the
paginationInfo
is requested, like with the following request:I'm not quite sure that this is the best way to implement that fix, I open this pull request to start the discussion. There is probably some other implementations I should look at (like cursor based pagination, perhaps the NormalizeProcessor) and add some tests. In the meantime what do you think of this approach ?
Thanks,