Skip to content

Event onPaginationChange is triggered on every history push in RSC #6158

@ivenuss

Description

@ivenuss

TanStack Table version

v8.21.3

Framework/Library version

[email protected], [email protected]

Describe the bug and the steps to reproduce it

Describe the issue

The reproduction is quite simple. I need to have parent component that is not a client component & pass prop data to the child Table component that has enabled pagination.

From now when anything is pushed to the URL (search params/hash) via Next.js's Link component or router.push from any level, this change will trigger onPaginationChange event.

If I change the page.tsx to client component via "use client" directive, it will no longer trigger the onPaginationChange, but in my case it needs to be a server component, since in this level I fetch the data from the server.

How I discovered it

In my setup I have Tanstack Table states persisted in the URL and when any state changes (sort/search filter) it will trigger onPaginationChange as well which is persisted to URL as well and this update updates the pagination search params URL even thought they haven't changed & this change will trigger again onPaginationChange (cuz URL has changed) resulting into infinite loop.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/6l8mtc

Screenshots or Videos (Optional)

demo.mov

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

No, because I do not know how

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions