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

chore: update default GraphQL query limit values #4297

Merged

Conversation

kieckhafer
Copy link
Member

Resolves #4278
Impact: minor
Type: chore

Issue

The query limits are not optimized on our GraphQL queries

Solution

Change default first value (when neither first nor last are provided by the client) to 20, to have a default that minimizes DB and server load
Change the max first and last values to 200

Breaking changes

none.

Testing

Test on at least one query that has > 205 items. For example, import > 205 tags or catalog items.

  • Using GraphQL client, query with no first or last param and make sure you get the first 20 back
  • Using GraphQL client, query with first=60 and make sure you get the first 60 back.
  • Using GraphQL client, query with first=201 and make sure you get the first 200 back.
  • Using GraphQL client, query with last=60 and make sure you get the last 60 back.
  • Using GraphQL client, query with last=201 and make sure you get the last 200 back.
  • Using the Reaction NextJS Starter Kit, connected to devserver, make sure the page size selector above the grid works correctly for all size options.

@kieckhafer kieckhafer changed the title chore: update default graphql query limit values [WIP] chore: update default graphql query limit values Jun 4, 2018
@kieckhafer kieckhafer changed the title [WIP] chore: update default graphql query limit values chore: update default GraphQL query limit values Jun 4, 2018
@kieckhafer kieckhafer requested a review from willopez June 4, 2018 18:16
// Enforce a `first: 50` limit if no user-supplied limit
const limit = first || last || 50;
// Enforce a `first: 20` limit if no user-supplied limit
const limit = first || last || 20;
Copy link
Contributor

@aldeed aldeed Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kieckhafer Can you add const DEFAULT_LIMIT = 20; at the top of the file and use that const here? We'll eventually put this in ENV but that's at least a little less magic for now.

@@ -7,13 +7,13 @@ beforeEach(() => {
});

test("with neither first nor last limits to first 50", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50 in the test name needs to change, too

@kieckhafer
Copy link
Member Author

@aldeed updated

@aldeed aldeed removed the request for review from willopez June 5, 2018 20:26
@aldeed aldeed merged commit fb67539 into release-1.13.0 Jun 5, 2018
@aldeed aldeed deleted the chore-kieckhafer-4278-updateDefaultQueryValues branch June 5, 2018 20:27
@spencern spencern mentioned this pull request Jun 12, 2018
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

Successfully merging this pull request may close these issues.

2 participants