Skip to content

Pagination resets to first page on data/column change even when using controlled pagination (page prop) with client-side data #1492

@bhood239

Description

@bhood239

Describe the bug
When using Grid.js with client-side data in a React project, the pagination resets to the first page whenever the data or columns prop changes—even if I am controlling the current page via the pagination prop (page, onChange, and resetPageOnUpdate: false). This happens, for example, when toggling a cell’s expanded state, which updates the data array or columns (even if the data is memoized and stable).

To Reproduce
Steps to reproduce the behavior:

  1. Use Grid.js with client-side data and controlled pagination (pagination={{ page, onChange, limit, resetPageOnUpdate: false }}).
  2. Change the data or columns (e.g., by toggling a cell’s expanded state).
  3. Observe that the table jumps back to the first page, even though the page prop is set to a different value.

Expected behavior
When I control the current page via the pagination prop, Grid.js should respect the page value and not reset to the first page when the data or columns change.

Workarounds tried:

  • Memoizing data and columns with useMemo
  • Using resetPageOnUpdate: false
  • Controlling page and onChange via React state
    None of these prevent the page reset, making it difficult to implement interactive tables (e.g., expandable rows, cell toggles) without breaking the user’s pagination context.

Desktop (please complete the following information):

  • OS: MacOS 15.3.2
  • Browser: Chrome
  • Version 135.0.7049.115

Additional context
Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions