-
Notifications
You must be signed in to change notification settings - Fork 509
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(Pagination): handle max > 5
and max
equal total pages
#728
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
Hi @Haythamasalama ! Thanks for the PR! Indeed there is no correct handling of
I'm fully open to rewrite that algorithm, I'm not really satisfied of what I've written initially and of how maintainable it is. But it should keep the initial behaviour, to allow some users to restrict the Pagination width and have a consistent UI. Also about your PR, it looks good when page 1 is selected, but not fine when moving to page 2/3 in this case: If you can fix that, we are good to go! π |
Thanks β€οΈ @smarroufin for explaining the However, after the explanation of what So, I made a refactor for it using the same algorithm to handle those cases. |
displayedPages()
max > 5
and max
equal total pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with your last updates! Works very well!
Also, to be a bit picky, why wouldn't we remove (or update) the props.max
validator with it?
I guess it doesn't make sens since we fallback to a valid value on our own now.
validate (value) {
return value >= 7 && value < Number.MAX_VALUE
}
I agree that we need to set the maximum value on the validator to 5, but should we remove the number from here?
const maxDisplayedPages = Math.max(props.max, 5) |
Do you mean 5 as minimum value? Then yes. From 5 to anything. And I guess your fallback is to be kept anyways, otherwise we would end up with the issue we currently have, meaning that the docs number select can "disrespect" the validator by giving an unappropriated number. |
Sure, I've updated to 5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good for me, thanks a lot @Haythamasalama!
You're welcome, @smarroufin β€οΈ. Thank you for reviewing it. |
π Linked issue
#723
β Type of change
π Description
Resolves #723