Skip to content
Source
Sign inSign up
TanStack/query

autoResetPageIndex not reseting properly #7210

Send to my agent
Closedmarcellino-ornelas(GitHub profile, opens in a new tab) opened this issue 3 comments

Describe the bug

Hello, Im running into a issue with the autoResetPageIndex showing/processing the incorrect page Index when using client side pagination and changing the rows per page.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-table-csasqf?file=src%2Fmain.tsx

Steps to reproduce

  1. Click next page 2 times so you see Page 3 of 10,000
  2. Click the rows per page option
  3. Select option show 20

You will now see the incorrect number Page 2 of 5,000

Expected behavior

  1. Click next page 2 times so you see Page 3 of 10,000
  2. Click the rows per page option
  3. Select option show 20

You should now see Page 1 of 5,000

How often does this bug happen?

Every time

Screenshots or Videos

https://github.com/TanStack/query/assets/35247622/969eb333-4b99-499a-85b9-4b9415224ca9

Platform

  • macOS 14.4.1
  • Chrome 123.0.6312.87 (Official Build) (x86_64)

Tanstack Query adapter

react-query

TanStack Query version

8.15.0

TypeScript version

5.1.6

Additional context

No response

  1. Current work around

    const handleChangeRowsPerPage = useCallback(
            (event: React.ChangeEvent<HTMLInputElement>): void => {
                table.setPageIndex(0);
                table.setPageSize(Number(event.target.value));
            },
            [table],
        );
  2. wrong repo. did you mean to open this in tanstack/table ?

  3. TkDodo closed this

  4. TkDodo added labelsinvalid

  5. 🤦🏽‍♂️ sorry about that, yes wrong repo. Will report this on tanstack/table

Sign in to join this conversation.