Skip to content

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

Merged
KevinVandy merged 2 commits into
mainfrom
fix-app-wrapper-stale-cells
Oct 12, 2026
Merged

KevinVandy merged 2 commits into
mainfrom
fix-app-wrapper-stale-cells

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

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.

…ls and headers

Svelte's App* wrappers destructured their props, which read the prop getters once, and Vue's setup() read props.cell once. A keyed {#each} or v-for that reused a wrapper with a new cell or header (same id, e.g. after replacing data or columns) kept the first instance for both the snippet/slot value and the context.

Forward wrapper props through getters, read the prop reactively, and provide a live proxy that forwards to the current instance. Prototype methods run against the real instance so per-instance memos never capture the proxy.
@changeset-bot

changeset-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9245a93

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

This PR includes changesets to release 2 packages
Name Type
@tanstack/svelte-table Patch
@tanstack/vue-table Patch

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

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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 e26e988 and 9245a93.


📒 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
Loading

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 name Status Explanation Resolution
Docstring Coverage Warning 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: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The 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 name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The 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.

@nx-cloud

nx-cloud Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 9245a93

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 3m 15s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 34s View ↗

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

🟩 Patch bumps

Package Version Reason
@tanstack/preact-table 9.3.0 → 9.3.1 Changeset
@tanstack/react-table 9.3.0 → 9.3.1 Changeset
@tanstack/svelte-table 9.3.0 → 9.3.1 Changeset
@tanstack/table-core 9.3.0 → 9.3.1 Changeset
@tanstack/table-devtools 9.3.0 → 9.3.1 Changeset
@tanstack/vue-table 9.3.0 → 9.3.1 Changeset
@tanstack/alpine-table 9.3.0 → 9.3.1 Dependent
@tanstack/angular-table 9.3.0 → 9.3.1 Dependent
@tanstack/angular-table-devtools 9.3.0 → 9.3.1 Dependent
@tanstack/ember-table 9.3.0 → 9.3.1 Dependent
@tanstack/lit-table 9.3.0 → 9.3.1 Dependent
@tanstack/octane-table 9.3.0 → 9.3.1 Dependent
@tanstack/preact-table-devtools 9.3.0 → 9.3.1 Dependent
@tanstack/react-table-devtools 9.3.0 → 9.3.1 Dependent
@tanstack/solid-table 9.3.0 → 9.3.1 Dependent
@tanstack/solid-table-devtools 9.3.0 → 9.3.1 Dependent
@tanstack/vue-table-devtools 9.3.0 → 9.3.1 Dependent

@KevinVandy
KevinVandy marked this pull request as ready for review October 12, 2026 15:31
@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown
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

@KevinVandy
KevinVandy merged commit 67e8251 into main Oct 12, 2026
10 checks passed
@KevinVandy
KevinVandy deleted the fix-app-wrapper-stale-cells branch October 12, 2026 15:51
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
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