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

Clicking last page in pagination reverts to first page #18

Closed
wants to merge 1 commit into from

Conversation

@s-arika
Copy link
Contributor

s-arika commented Oct 21, 2019

Fixes for #17

I removed

if (this._page * this.itemsPerPage > this.totalItems) { this._page = 1; }

If the page is at 4 and it's multiplied by 500, it exceeds the total items. I believe this is causing the page to revert to 1.

@n15g

This comment has been minimized.

Copy link
Owner

n15g commented Oct 21, 2019

I added that in as part of fixing #7 as if the page number exceeded the length of the list, it through one of those 'content changed after view render' errors... which are harmless...ish but unsightly in dev.

I suspect this is just one of those good-old off-by-one errors.

Would you mind changing it to if ((this._page - 1) * this.itemsPerPage > this.totalItems) { this._page = 1; } rather than removing it and seeing if that resolves the issue?

@n15g

This comment has been minimized.

Copy link
Owner

n15g commented Oct 21, 2019

I applied the patch above and that fixed it without removing the reset to page 1 if it overflows. Thanks for the heads-up.

@n15g n15g closed this Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.