TanStack / TanStack/table

Manual Pagination doesn't update `table.getRowModel().rows` - it shows all results

Open
#4,917 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
28.4k
Forks
3.6k
Avg merge
1d 14h
Merged PRs (30d)
10

Description

Describe the bug

I was looking at the manual pagination example here:
https://tanstack.com/table/v8/docs/examples/react/pagination-controlled and noticed that the pagination is happening at the query level.

When trying to add the pagination client side, the logic seems to work properly, but the content doesn't update based on the new pagination values. A reproducible example is here:
https://codesandbox.io/p/sandbox/boring-wilbur-fqkd7r?embed=1&file=%2Fsrc%2Fmain.tsx%3A79%2C37-82%2C6

My default pagination object looks like this:

{
      pageIndex: 0,
      pageSize: 10
}

but the table shows 100 results. if I change the visible rows from the dropdown in the UI or change the page, the table always shows the whole payload vs paginated results.

Am I actually supposed to slice the data myself off table.getRowModel().rows?

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/boring-wilbur-fqkd7r?embed=1&file=%2Fsrc%2Fmain.tsx%3A79%2C37-82%2C6

Steps to reproduce

Just load the UI and see the data is not being paginated

Expected behavior

Table should only show 10 items as per the default object

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

whatever codesandbox is running on

react-table version

v8.9.2

TypeScript version

No response

Additional context

No response

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the controlled pagination example linked in the issue and inspect the reproducible CodeSandbox, especially the table setup and row rendering around the referenced main.tsx lines. Compare the pagination configuration with the row model being rendered. Done means the default view shows 10 items and changing the page or page size updates the displayed rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.