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

Per Page returns default when 0 is passed in for Search Pagination #94

Open
pcasa opened this issue Feb 23, 2020 · 3 comments
Open

Per Page returns default when 0 is passed in for Search Pagination #94

pcasa opened this issue Feb 23, 2020 · 3 comments

Comments

@pcasa
Copy link
Contributor

pcasa commented Feb 23, 2020

On Agg calls, not interested in any of the hits items.

Example.

{
  users(aggs:{
    key:"my_agg", 
    value: {
    terms: {field:firstName, size:1000}
    }
  }, 
    perPage: 0) 
  {
    aggregations
    items {
      ...
    }
  }
}

The above will still return 20 items

@pcasa
Copy link
Contributor Author

pcasa commented Feb 23, 2020

Think problem coming from here

possible solution:
const perPage = parseInt(args.perPage ) !== NaN ? args.perPage : 20;

@nodkz
Copy link
Member

nodkz commented Feb 23, 2020

Argument perPage already parsed by graphql. And if it is non-integer - then the client got an error.

Why do you want to pass 0 value for perPage?

If you want to fix this you may send the following PR

- const perPage = args.perPage || 20;
+ const perPage = args.perPage ?? 20;

and add nullish-coalescing-operator to the babel config.

@pcasa
Copy link
Contributor Author

pcasa commented Feb 23, 2020

Passing 0 because doing an Agg call.

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

No branches or pull requests

2 participants