Skip to content
Source
Sign inSign up
TanStack/table

fix(table-core): reset expansion when data changes #6443

ClosedKevinVandywants to merge 1 commit intobeta fromrefs/pull/6443/headopened

KevinVandycommented

Closes #5801

Decision

This remains a valid, narrowly scoped bug in the latest v9 beta. The existing automatic expansion reset is attached to the grouped row-model stage, so it happens only when grouping support is installed. A table using row expansion without grouping retains stale expanded row IDs after its data reference changes, despite the autoResetExpanded option contract.

This is not a new API or a behavior redesign. It connects the existing reset helper to the core data-dependent row model, alongside the existing automatic page-index reset.

Changes

  • run the existing expanded-state auto-reset after the core row model recomputes for a new data reference
  • add an end-to-end regression test using expansion without the grouping feature
  • retain the existing autoResetAll, autoResetExpanded, manualExpanding, initial-state, and controlled-state updater semantics

Verification

  • regression test fails on beta before the implementation change, retaining the expanded row ID
  • table-core focused auto-reset suite: 22 tests passed
  • full table-core suite: 52 files and 1,005 tests passed
  • TypeScript source and declaration-emit checks passed
  • ESLint passed for changed files
  • Prettier check passed for changed files
    1. Important

      Review skipped

      Draft detected.

      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: 5813e0fd-0154-46ee-84fd-b920e2142181

      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
      • Commit unit tests in branch `agent/fix-5801-auto-reset-expanded`

      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.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 0b815c92b1832078d8ec0f3c19a83cfccbc60445

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...❌ Failed5m 23sView ↗
      nx run-many --targets=build --exclude=examples/**✅ Succeeded51sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-07-18 00:43:33 UTC

    3. More templates

      @tanstack/alpine-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/alpine-table@6443

      @tanstack/angular-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table@6443

      @tanstack/angular-table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table-devtools@6443

      @tanstack/ember-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/ember-table@6443

      @tanstack/lit-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/lit-table@6443

      @tanstack/match-sorter-utils

      npm i https://pkg.pr.new/TanStack/table/@tanstack/match-sorter-utils@6443

      @tanstack/preact-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table@6443

      @tanstack/preact-table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table-devtools@6443

      @tanstack/react-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table@6443

      @tanstack/react-table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table-devtools@6443

      @tanstack/solid-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table@6443

      @tanstack/solid-table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table-devtools@6443

      @tanstack/svelte-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/svelte-table@6443

      @tanstack/table-core

      npm i https://pkg.pr.new/TanStack/table/@tanstack/table-core@6443

      @tanstack/table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/table-devtools@6443

      @tanstack/vue-table

      npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table@6443

      @tanstack/vue-table-devtools

      npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table-devtools@6443

      commit: 0b815c9

    4. riccardoperra reviewed

      @@ -25,4 +26,6 @@
      2526 fnName: 'table.getCoreRowModel',
      2627 memoDeps: () => [table.options.data],
      2728 fn: () => _createCoreRowModel(table, table.options.data),
      28- onAfterUpdate: () => table_autoResetPageIndex(table),
      29+ onAfterUpdate: () => {
      30+ table_autoResetExpanded(table)
      31+ table_autoResetPageIndex(table)

      We could use batchfrom reactivity here I think, or move the batch invocation into onAfterUpdate 🤔

    5. KevinVandy closed this

Sign in to join this conversation.