Skip to content

GroupedRowModel is incompatible with Pagination #6025

Open
@smaspe

Description

@smaspe

TanStack Table version

v8.21.3

Framework/Library version

React v18.2.0

Describe the bug and the steps to reproduce it

When the table is initialized with a pagination state, and the getGroupedRowModel is set, the pageIndex is immediately reset to 0.

Here is a demo https://codesandbox.io/p/devbox/github/tanstack/table/tree/main/examples/react/pagination?embed=1&theme=light

It is taken directly from the pagination example, with 2 changes:

  • Updating the initial pageIndex to (for example) 5
  • Add getGroupedRowModel: getGroupedRowModel(), to the table options

(Note: this also occurs when a grouping state is passed, but having a grouping state is not required to see the issue)

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/github/tanstack/table/tree/main/examples/react/pagination?embed=1&theme=light

Screenshots or Videos (Optional)

No response

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

Yes, I am also opening a PR that solves the problem along side this issue

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