Skip to content
Source
Sign inSign up
TanStack/table

fix(svelte-table, vue-table): Keep App* wrappers in sync with new cells and headers #6633

MergedKevinVandymerged 2 commits intomain fromrefs/pull/6633/headmerged by KevinVandy

KevinVandycommented

Related to #6618

When data or columns are replaced, a keyed {#each} or v-for reuses AppCell/AppHeader/AppFooter with a new cell or header that has the same id. The wrappers kept the first instance, so the snippet/slot value and useCellContext()/useHeaderContext() showed stale values (for example after a refetch).

  • Svelte: the App* wrappers destructured their props, which reads Svelte's prop getters once. They now forward cell, header, and children through getters. AppCell.svelte/AppHeader.svelte derive the extended instance from the current prop.
  • Vue: setup() read props.cell/props.header once. The extended instance is now a computed, and the slot gets its current value.
  • Context: both adapters provide a createLiveProxy view that forwards reads to the current instance. Prototype methods are called on the real instance, so per-instance memos (_memo_* capturing self) never see the proxy, and forwarders are cached per key so method identity is stable.
  • Added a regression test per adapter: keyed wrappers, replace data then columns, and assert the snippet/slot value and both contexts update. Both tests fail on main.

Notes

useCellContext()/useHeaderContext() now return the live view, not the cell/header object itself, so contextCell === cell is false. The alternative is returning a getter or signal like Angular's injectTableCellContext(), which is cleaner but breaks the API. Solid has the same pattern but is fine with <For> (keyed by identity); it would only go stale under <Index>.

Summary by CodeRabbit

  • Bug Fixes
    • Table cells, headers, and footers now reflect current props when table data or columns are replaced.
    • Cell and header context stays up to date, so rendered content and context values show the latest data and labels in Svelte and Vue tables.
    1. changeset-bot[bot](GitHub profile, opens in a new tab)commented

      🦋 Changeset detected

      Latest commit: 9245a93a909b7d45b90760e793db20acbe0edfcb

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 2 packages
      NameType
      @tanstack/svelte-tablePatch
      @tanstack/vue-tablePatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: TanStack/table/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: f6a981a6-eec1-482e-ba68-cc50e22c581b

      📥 Commits

      Reviewing files that changed from the base of the PR and between e26e988cba9864d678994bdabeb352b706a5d685 and 9245a93a909b7d45b90760e793db20acbe0edfcb.


      📒 Files selected for processing (11)
      • .changeset/app-wrapper-live-cells.md
      • packages/svelte-table/src/AppCell.svelte
      • packages/svelte-table/src/AppHeader.svelte
      • packages/svelte-table/src/createTableHook.svelte.ts
      • packages/svelte-table/src/live-proxy.ts
      • packages/svelte-table/tests/fixtures/HookDataRefresh.svelte
      • packages/svelte-table/tests/fixtures/HookHeaderLabel.svelte
      • packages/svelte-table/tests/rendering.test.ts
      • packages/vue-table/src/createTableHook.ts
      • packages/vue-table/src/live-proxy.ts
      • packages/vue-table/tests/unit/rendering.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



      📝 Walkthrough
      📝 Walkthrough

      Walkthrough

      Svelte and Vue table wrappers now use current props to render cells and headers. Their contexts expose live views of the current extended objects. New tests check rendered output and context values after replacing table data or columns.

      Changes

      Live wrapper context

      Layer / File(s)Summary
      Reactive wrappers and live proxy
      packages/svelte-table/src/*, packages/vue-table/src/*, .changeset/app-wrapper-live-cells.md
      Svelte wrappers forward props through getters. Vue cell, header, and footer wrappers derive extended objects from current props. Both packages add a live proxy for context values.
      Replacement-data tests
      packages/svelte-table/tests/fixtures/*, packages/svelte-table/tests/rendering.test.ts, packages/vue-table/tests/unit/rendering.test.ts
      Tests replace data or columns and check updated cell output, component output, header labels, and context values.

      Priority: ➖ Normal

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix

      Sequence Diagram(s)

      sequenceDiagram
        participant TableData
        participant AppCell
        participant createLiveProxy
        participant ContextConsumer
        TableData->>AppCell: Pass updated cell props
        AppCell->>createLiveProxy: Provide a proxy for the current extended cell
        ContextConsumer->>createLiveProxy: Read cell properties
        createLiveProxy->>ContextConsumer: Resolve properties from the current cell

      Merge Risk: ⚪ Minimal · up to 9245a

      No actionable issue is established from the available evidence; run the adapter tests as part of normal checks before merging.

      Pre-merge checks | Passed 3 | Failed 2

      ❌ Failed checks (2 warnings)

      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 6 files. (5 skipped: …Write docstrings for the functions missing them to satisfy the coverage threshold.
      Description checkWarningThe description clearly explains the bug, implementation, API impact, and regression tests. However, it omits the required "## 🎯 Changes", "## ✅ Checklist", and "## 🚀 Release Impact" sections, includi…Add the required template sections. Complete the checklist, state whether the required tests were run or do not apply, confirm AI-assisted code review, and select the applicable release-impact option. Retain the existing technical explanati…
      ✅ Passed checks (3 passed)
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly identifies the fix and the affected Svelte and Vue App* wrappers. It accurately summarizes the main change.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 6 files. (5 skipped: 5 unsupported.)


      Full details: Description check

      Explanation

      The description clearly explains the bug, implementation, API impact, and regression tests. However, it omits the required "## 🎯 Changes", "## ✅ Checklist", and "## 🚀 Release Impact" sections, including checklist confirmations and release-impact information.

      Resolution

      Add the required template sections. Complete the checklist, state whether the required tests were run or do not apply, confirm AI-assisted code review, and select the applicable release-impact option. Retain the existing technical explanation and test details under the Changes section.


      • Fix all pre-merge checks with AI
      ✨ Finishing Touches 💡 1
      📝 Generate docstrings 💡
      • Commit to this branch
      • Create a new PR

      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR

      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

      View your CI Pipeline Execution ↗ for commit 9245a93a909b7d45b90760e793db20acbe0edfcb

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded3m 15sView ↗
      nx run-many --targets=build --exclude=examples/**✅ Succeeded34sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-12 15:37:11 UTC

    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      🚀 Changeset Version Preview

      6 package(s) bumped directly, 11 bumped as dependents.

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/preact-table9.3.0 → 9.3.1Changeset
      @tanstack/react-table9.3.0 → 9.3.1Changeset
      @tanstack/svelte-table9.3.0 → 9.3.1Changeset
      @tanstack/table-core9.3.0 → 9.3.1Changeset
      @tanstack/table-devtools9.3.0 → 9.3.1Changeset
      @tanstack/vue-table9.3.0 → 9.3.1Changeset
      @tanstack/alpine-table9.3.0 → 9.3.1Dependent
      @tanstack/angular-table9.3.0 → 9.3.1Dependent
      @tanstack/angular-table-devtools9.3.0 → 9.3.1Dependent
      @tanstack/ember-table9.3.0 → 9.3.1Dependent
      @tanstack/lit-table9.3.0 → 9.3.1Dependent
      @tanstack/octane-table9.3.0 → 9.3.1Dependent
      @tanstack/preact-table-devtools9.3.0 → 9.3.1Dependent
      @tanstack/react-table-devtools9.3.0 → 9.3.1Dependent
      @tanstack/solid-table9.3.0 → 9.3.1Dependent
      @tanstack/solid-table-devtools9.3.0 → 9.3.1Dependent
      @tanstack/vue-table-devtools9.3.0 → 9.3.1Dependent
    5. More templates

      @tanstack/alpine-table

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

      @tanstack/angular-table

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

      @tanstack/angular-table-devtools

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

      @tanstack/ember-table

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

      @tanstack/lit-table

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

      @tanstack/match-sorter-utils

      npm i https://pkg.pr.new/@tanstack/match-sorter-utils@6633

      @tanstack/octane-table

      npm i https://pkg.pr.new/@tanstack/octane-table@6633

      @tanstack/preact-table

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

      @tanstack/preact-table-devtools

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

      @tanstack/react-table

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

      @tanstack/react-table-devtools

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

      @tanstack/solid-table

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

      @tanstack/solid-table-devtools

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

      @tanstack/svelte-table

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

      @tanstack/table-core

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

      @tanstack/table-devtools

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

      @tanstack/vue-table

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

      @tanstack/vue-table-devtools

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

      commit: 9245a93

    6. KevinVandy merged this67e8251

    7. KevinVandy closed this

Sign in to join this conversation.