Skip to content
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

Pass-in "where" arguments to count query in ra-data-hasura #2100

Closed
aam1r opened this issue Apr 30, 2019 · 1 comment
Closed

Pass-in "where" arguments to count query in ra-data-hasura #2100

aam1r opened this issue Apr 30, 2019 · 1 comment
Assignees

Comments

@aam1r
Copy link

aam1r commented Apr 30, 2019

When doing GET_LIST and GET_MANY_REFERENCE, ra-data-hasura generates a WHERE object to pass in for the select * query.

However, it does not do this for the count (*) that it does as part of the same request.

As a result, incorrect data is shown (for example: in pagination) where there might only be a few items to show because of the where restrictions but the total count shown in the pagination table is the number of items in the entire table.

@aam1r
Copy link
Author

aam1r commented Apr 30, 2019

Let me know and I can do this.

If you'd like to do it yourself, you can do so by adding:

finalCountQuery.args.where = params.filter;

after https://github.com/hasura/graphql-engine/blob/master/community/tools/ra-data-hasura/src/index.js#L30.

And by adding

finalManyCountQuery.args.where = { [params.target]: params.id };

after https://github.com/hasura/graphql-engine/blob/master/community/tools/ra-data-hasura/src/index.js#L111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants