Skip to content

fix(pagination): autoResetPageIndex should reset to 0, not initialState pageIndex#6208

Open
sleitor wants to merge 1 commit intoTanStack:mainfrom
sleitor:fix-6207
Open

fix(pagination): autoResetPageIndex should reset to 0, not initialState pageIndex#6208
sleitor wants to merge 1 commit intoTanStack:mainfrom
sleitor:fix-6207

Conversation

@sleitor
Copy link

@sleitor sleitor commented Mar 19, 2026

Summary

Fixes #6207

When autoResetPageIndex fires (e.g. after data/filter changes), it now calls table.resetPageIndex(true) to reset to 0 (the default page) instead of table.resetPageIndex() which resets to initialState.pagination.pageIndex.

Root cause

In RowPagination.ts, _autoResetPageIndex called table.resetPageIndex() without defaultState = true:

// Before
table.resetPageIndex()   // resets to initialState.pageIndex (e.g. 5 from URL restoration)
// After
table.resetPageIndex(true)  // always resets to 0

This caused issues when initialState.pagination.pageIndex was set to a non-zero value (e.g. restored from URL params). After a filter change that reduced total pages, the table would reset to the initial page (e.g. page 5) rather than page 0, leaving users on an empty/invalid page.

Changes

  • packages/table-core/src/features/RowPagination.ts: pass true to resetPageIndex() in _autoResetPageIndex
  • Added changeset for patch bump of @tanstack/table-core

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c3cf5907-3cae-4694-a200-4bacf67550c6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant