Skip to content

Fix: correct next page logic in calculateNextPage utility #431

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

Merged
merged 2 commits into from
May 28, 2025

Conversation

Krishprajapati15
Copy link
Contributor

Fixed an issue in calculateNextPage where it incorrectly allowed next page even if currentPage > totalPages. Now it returns the next page only if more pages exist. This improves the accuracy of HAL pagination and prevents broken next links.

@IbenTesara IbenTesara added bug Something isn't working js-pagination @studiohyperdrive/nodejs-hal-tools labels May 28, 2025
@IbenTesara
Copy link
Contributor

Hi @Krishprajapati15!

Thanks for your contribution! I've updated the PR and assigned the correct people. Once we've approved this PR we'll prepare a release and notify you as well.

Copy link
Member

@jsprds jsprds left a comment

Choose a reason for hiding this comment

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

LGTM!

@DenisValcke
Copy link
Contributor

@Krishprajapati15 would it be possible to add unit testing for your use-case to the spec.ts file next to this one (libs/javascript/pagination/src/hal-format.helper.spec.ts). If that's done, let us know & we will proceed and merge/tag/publish this change for you.

Thanks.

@Krishprajapati15
Copy link
Contributor Author

Krishprajapati15 commented May 28, 2025

Thank you all for the reviews and approvals!

@DenisValcke – I appreciate the suggestion. I've added the corresponding unit tests for the updated logic in calculateNextPage to the hal-format.helper.spec.ts file as requested. Please let me know if any further adjustments are needed.

Looking forward to the merge and release. Thanks again for the support and feedback!

Best regards,
Krish Prajapati

@IbenTesara IbenTesara merged commit d176739 into studiohyperdrive:master May 28, 2025
@IbenTesara IbenTesara added this to the nodejs-hal-tools:v2.0.1 milestone May 28, 2025
@IbenTesara
Copy link
Contributor

@Krishprajapati15 the new version has been published!

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js-pagination @studiohyperdrive/nodejs-hal-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants