Skip to content

onPaginationChange when used on client side, always returns pageIndex 0 #5970

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

Open
2 tasks done
karolis-palsauskas-devoteam opened this issue Mar 17, 2025 · 0 comments
Open
2 tasks done

Comments

@karolis-palsauskas-devoteam

TanStack Table version

"@tanstack/react-table": "^8.21.2"

Framework/Library version

"react": "^18.3.1"

Describe the bug and the steps to reproduce it

Hey,

Through app we use both client and server side pagination. In all cases we are required to update URL params to reflect pagination (page, page size, sort applied, etc.). Because of this on client side pagination I provide custom "onPaginationChange" which includes URL update method

When implementing table, I encountered behavior where "onPaginationChange":

  • Is fired even when sorting is applied
  • When fired, always returns pageIndex 0, even if initial value was any other value

Possible bug: "onPaginationChange" returns incorrect prevState when used in "client" mode?

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/sandbox/k3dnff

Screenshots or Videos (Optional)

Image

going directly to any other page, and clicking "Next", in console.log you can see it returns pageIndex 0

If you change mode to "server" everything works as expected

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
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

No branches or pull requests

1 participant