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

fix: on getAll methods, use MAX_PAGE_SIZE when pageSize param is falsey #195

Merged
merged 2 commits into from
Oct 5, 2021

Conversation

angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Oct 4, 2021

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

All getAll* methods default pageSize to MAX_PAGE_SIZE (currently 100). The default was only set if a pageSize parameter was not provided. For example, if a user provides a pageSize of undefined, pageSize will be undefined, not the default.

With this PR, pageSize will be set to MAX_PAGE_SIZE on any falsey value (including 0, undefined, null, and no value).

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

🦧

@angeloashmore angeloashmore changed the title fix: use MAX_PAGE_SIZE when pageSize param is nullish on getAll methods fix: use MAX_PAGE_SIZE when pageSize param is falsey on getAll methods Oct 4, 2021
@angeloashmore angeloashmore changed the title fix: use MAX_PAGE_SIZE when pageSize param is falsey on getAll methods fix: on getAll methods, use MAX_PAGE_SIZE when pageSize param is falsey Oct 4, 2021
Copy link
Member

@lihbr lihbr left a comment

Choose a reason for hiding this comment

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

I don't get why you moved the pageSize parameter below the lang one 🤔 is it only for styling purposes?

LGTM

@angeloashmore
Copy link
Member Author

angeloashmore commented Oct 5, 2021

I don't get why you moved the pageSize parameter below the lang one 🤔 is it only for styling purposes?

It's due to the order of URL parameters. This PR makes pageSize always the last parameter. In the test, it compares the URL parameters as a string so order matters. It probably should convert it to an object and compare it (maybe t.deepEqual works on URLSearchParams).

Thanks for the review - I'll merge and publish.

@angeloashmore angeloashmore merged commit 46b638a into v6 Oct 5, 2021
@lihbr
Copy link
Member

lihbr commented Oct 6, 2021

Oh OK, makes sense, works this way, no worries!

@lihbr lihbr deleted the aa/fix-getAll-pageSize branch January 5, 2022 10:37
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