Skip to content

Add more reactivity test for alpine, preact, ember, lit, svelte - #6462

Merged
KevinVandy merged 3 commits into
betafrom
test/adapters-reactivity-test
Jul 29, 2026
Merged

Add more reactivity test for alpine, preact, ember, lit, svelte#6462
KevinVandy merged 3 commits into
betafrom
test/adapters-reactivity-test

Conversation

@riccardoperra

@riccardoperra riccardoperra commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Added more test for alpine, preact, ember, lit, svelte. Also this fixes the missing cleanup in ember adapter integration

Ember fixes

Improved Ember adapter lifecycle handling by allowing useTable and createAppTable to receive an Ember owner. Table reactivity is now automatically cleaned up when that owner is destroyed, preventing external atoms and destroyed tables from continuing to update each other.

The existing owner-less API remains supported for standalone usage. Tests cover cleanup in both update directions, external atom precedence, state synchronization, and rendering behavior.

Summary by CodeRabbit

  • New Features

    • Improved grouped-table rendering across Alpine, Ember, Lit, Svelte, and Preact.
    • Aggregated cells now use dedicated aggregate content, while placeholder cells remain hidden.
    • Lit rendering now supports a broader range of values and renderable content.
    • Added improved lifecycle handling for Ember and Lit table integrations.
  • Bug Fixes

    • Improved reactive updates, external state synchronization, reconnection behavior, and callback freshness.
    • Enhanced Preact compatibility with memoized and forwarded components.
    • Improved server-side rendering support and consistency across adapters.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds grouped-cell rendering support across adapters, Ember owner lifecycle cleanup, Lit renderable typing, Svelte option synchronization, Preact exotic-component handling, and broad framework-specific reactivity, rendering, lifecycle, and SSR tests.

Changes

Adapter rendering and reactivity

Layer / File(s) Summary
Grouped and placeholder cell rendering
packages/*-table/src/FlexRender*, packages/*-table/tests/*render*
Cell rendering now selects normal, aggregated, or placeholder output across Alpine, Ember, Lit, Preact, and Svelte, with DOM and SSR coverage.
Ember owner lifecycle and state precedence
packages/ember-table/src/*, packages/ember-table/tests/integration/*
Ember table creation accepts an owner, registers teardown cleanup, and tests controlled-state ownership, external atom precedence, bridge disconnection, and current callbacks.
Lit rendering and controller lifecycle
packages/lit-table/src/*, packages/lit-table/tests/unit/*
Lit renderables and wrapper APIs are widened, reconnects request updates, subscription directives refresh on reattachment, and lifecycle behavior is tested.
Svelte reactive table integration
packages/svelte-table/src/*, packages/svelte-table/tests/*
Merged options and state dependencies are synchronized reactively, with coverage for selectors, atoms, callbacks, pagination, hook contexts, rendering, and SSR.
Preact and React subscription coverage
packages/preact-table/*, packages/react-table/tests/*
Preact rendering handles React exotic components and preserves falsy values; subscription isolation, option refresh, lifecycle, wrapper, and SSR behavior are tested.

Estimated code review effort: 5 (Critical) | ~120 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.87% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: added reactivity tests across Alpine, Preact, Ember, Lit, and Svelte adapters.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/adapters-reactivity-test

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.

@riccardoperra
riccardoperra force-pushed the test/adapters-reactivity-test branch from 7952940 to 619d1af Compare July 29, 2026 22:10
@nx-cloud

nx-cloud Bot commented Jul 29, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 619d1af

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

☁️ Nx Cloud last updated this comment at 2026-07-29 22:27:11 UTC

@socket-security

socket-security Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​testing-library/​preact@​3.2.49910010086100
Addedpreact-render-to-string@​6.7.010010010089100
Added@​testing-library/​svelte@​5.4.210010010097100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

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

@tanstack/angular-table

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

@tanstack/angular-table-devtools

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

@tanstack/ember-table

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

@tanstack/lit-table

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

@tanstack/match-sorter-utils

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

@tanstack/preact-table

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

@tanstack/preact-table-devtools

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

@tanstack/react-table

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

@tanstack/react-table-devtools

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

@tanstack/solid-table

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

@tanstack/solid-table-devtools

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

@tanstack/svelte-table

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

@tanstack/table-core

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

@tanstack/table-devtools

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

@tanstack/vue-table

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

@tanstack/vue-table-devtools

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

commit: e8bf34f

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

We changed BoundFlexRenderComponent from Component<Record<string, never>> to Component<Record<string, any>> to fix the TypeScript type errors in the Svelte example apps. Record<string, never> made every prop value an impossible never type, causing TypeScript to reject the Header_Core<...> values passed via <header.FlexRender header={header} />. Our fix correctly represents a pre-bound component that can accept any props.

Tip

We verified this fix by re-running tanstack-svelte-table-example-composable-tables:test:types.

diff --git a/packages/svelte-table/src/createTableHook.svelte.ts b/packages/svelte-table/src/createTableHook.svelte.ts
index afe06809..c25799d2 100644
--- a/packages/svelte-table/src/createTableHook.svelte.ts
+++ b/packages/svelte-table/src/createTableHook.svelte.ts
@@ -38,7 +38,7 @@ import type {
 } from '@tanstack/table-core'
 
 export type ComponentType<T extends Record<string, any>> = Component<T>
-export type BoundFlexRenderComponent = Component<Record<string, never>>
+export type BoundFlexRenderComponent = Component<Record<string, any>>
 
 function createLiveView<TCurrent extends object, TExtensions extends object>(
   getCurrent: () => TCurrent,

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally eiWd-HgmI

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

@riccardoperra
riccardoperra marked this pull request as ready for review July 29, 2026 22:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
packages/ember-table/tests/integration/external-state.test.gts (1)

763-766: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Capture the table outside the tracked getter.

Assigning capturedTable as a side effect of a tracked getter couples the capture to render timing and makes the later capturedTable! assertions implicitly dependent on the template having rendered. A field-level capture is clearer and equally valid.

♻️ Suggested refactor
     class TableComponent extends Component {
       table = useTable(this, () => ({
         data: makeData(...UNSORTED.map((firstName) => ({ firstName }))),
         columns,
         features,
         atoms: { pagination: paginationAtom },
       }))
 
+      constructor(...args: ConstructorParameters<typeof Component>) {
+        super(...args)
+        capturedTable = this.table
+      }
+
       get pageSize() {
-        capturedTable = this.table
         return this.table.store.state.pagination.pageSize
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ember-table/tests/integration/external-state.test.gts` around lines
763 - 766, Move the capturedTable assignment out of the tracked pageSize getter
and initialize it at field level when the table instance is created. Keep the
getter limited to returning this.table.store.state.pagination.pageSize, while
preserving the existing capturedTable assertions.
packages/lit-table/src/createTableHook.ts (1)

778-779: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Route header/footer through FlexRender too, for symmetry with AppCell.

cellFlexRender now delegates to FlexRender({ cell }) (Line 747), but header/footer still call flexRender(...) directly. Behavior is identical today (FlexRender's header/footer branches do exactly this per packages/lit-table/src/flexRender.ts:131-144), so this is purely about keeping one rendering entry point as FlexRender grows special cases.

♻️ Suggested refactor
-          const headerFlexRender = () =>
-            flexRender(header.column.columnDef.header, header.getContext())
+          const headerFlexRender = () => FlexRender({ header })
-          const footerFlexRender = () =>
-            flexRender(header.column.columnDef.footer, header.getContext())
+          const footerFlexRender = () => FlexRender({ footer: header })

Also applies to: 808-809

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/lit-table/src/createTableHook.ts` around lines 778 - 779, Update the
header and footer render helpers in createTableHook to delegate through
FlexRender using the appropriate header/footer props, matching cellFlexRender’s
FlexRender({ cell }) pattern. Replace the direct flexRender calls while
preserving the existing header and footer contexts and output behavior.
packages/lit-table/src/subscribe-directive.ts (1)

155-159: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate render logic with createFakeHost().requestUpdate.

The value-render snippet here is identical to the one in requestUpdate (Lines 171-173). Extract a small private helper to keep both call sites in sync going forward.

♻️ Suggested extraction
+  private renderCurrentValue(): void {
+    if (this.resolvedTemplate && this.controller) {
+      this.setValue(this.resolvedTemplate(this.controller.value))
+    }
+  }
+
   /** Restores the controller subscription when the directive is re-attached to the DOM. */
   reconnected() {
     this.controller?.hostUpdate()
-    if (this.resolvedTemplate && this.controller) {
-      this.setValue(this.resolvedTemplate(this.controller.value))
-    }
+    this.renderCurrentValue()
   }
       requestUpdate: () => {
-        if (this.resolvedTemplate && this.controller) {
-          this.setValue(this.resolvedTemplate(this.controller.value))
-        }
+        this.renderCurrentValue()
       },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/lit-table/src/subscribe-directive.ts` around lines 155 - 159,
Extract the duplicated resolved-template rendering logic from reconnected() and
requestUpdate into a small private helper, preserving the existing guards and
calls to setValue with controller.value. Replace both call sites with the helper
so future changes remain synchronized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/ember-table/tests/integration/external-state.test.gts`:
- Around line 763-766: Move the capturedTable assignment out of the tracked
pageSize getter and initialize it at field level when the table instance is
created. Keep the getter limited to returning
this.table.store.state.pagination.pageSize, while preserving the existing
capturedTable assertions.

In `@packages/lit-table/src/createTableHook.ts`:
- Around line 778-779: Update the header and footer render helpers in
createTableHook to delegate through FlexRender using the appropriate
header/footer props, matching cellFlexRender’s FlexRender({ cell }) pattern.
Replace the direct flexRender calls while preserving the existing header and
footer contexts and output behavior.

In `@packages/lit-table/src/subscribe-directive.ts`:
- Around line 155-159: Extract the duplicated resolved-template rendering logic
from reconnected() and requestUpdate into a small private helper, preserving the
existing guards and calls to setValue with controller.value. Replace both call
sites with the helper so future changes remain synchronized.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: df42cc5a-2428-4832-a9b1-e3df0293c972

📥 Commits

Reviewing files that changed from the base of the PR and between 6d8a519 and e8bf34f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (53)
  • knip.json
  • packages/alpine-table/package.json
  • packages/alpine-table/src/flexRender.ts
  • packages/alpine-table/tests/unit/adapterCoverage.test.ts
  • packages/alpine-table/tsconfig.json
  • packages/ember-table/src/FlexRender.gts
  • packages/ember-table/src/create-table-hook.ts
  • packages/ember-table/src/use-table.ts
  • packages/ember-table/tests/integration/create-table-hook.test.gts
  • packages/ember-table/tests/integration/external-state.test.gts
  • packages/ember-table/tests/integration/flex-render.test.gts
  • packages/ember-table/tests/integration/reactivity.test.gts
  • packages/lit-table/package.json
  • packages/lit-table/src/TableController.ts
  • packages/lit-table/src/createTableHook.ts
  • packages/lit-table/src/flexRender.ts
  • packages/lit-table/src/subscribe-directive.ts
  • packages/lit-table/tests/unit/adapterLifecycle.test.ts
  • packages/lit-table/tests/unit/defaultReactivity.test.ts
  • packages/lit-table/tests/unit/flexRender.test.ts
  • packages/lit-table/tests/unit/rendering.test.ts
  • packages/lit-table/tests/unit/selectorGate.test.ts
  • packages/lit-table/tsconfig.json
  • packages/preact-table/package.json
  • packages/preact-table/src/FlexRender.tsx
  • packages/preact-table/tests/unit/adapterReactivity.test.tsx
  • packages/preact-table/tests/unit/createTableHook.test.tsx
  • packages/preact-table/tests/unit/rendering.test.tsx
  • packages/preact-table/tests/unit/ssr.test.tsx
  • packages/preact-table/tests/unit/useTable.test.tsx
  • packages/react-table/tests/adapterReactivity.test.tsx
  • packages/svelte-table/package.json
  • packages/svelte-table/src/FlexRender.svelte
  • packages/svelte-table/src/createTable.svelte.ts
  • packages/svelte-table/tests/adapter-lifecycle.test.ts
  • packages/svelte-table/tests/fixtures/CallbackHarness.svelte
  • packages/svelte-table/tests/fixtures/ContextFailure.svelte
  • packages/svelte-table/tests/fixtures/FlexRenderHarness.svelte
  • packages/svelte-table/tests/fixtures/HookCellBadge.svelte
  • packages/svelte-table/tests/fixtures/HookHarness.svelte
  • packages/svelte-table/tests/fixtures/HookHeaderBadge.svelte
  • packages/svelte-table/tests/fixtures/HookTableBadge.svelte
  • packages/svelte-table/tests/fixtures/PaginationHarness.svelte
  • packages/svelte-table/tests/fixtures/ReactivityHarness.svelte
  • packages/svelte-table/tests/fixtures/RenderBadge.svelte
  • packages/svelte-table/tests/fixtures/SelectorHarness.svelte
  • packages/svelte-table/tests/fixtures/SsrHarness.svelte
  • packages/svelte-table/tests/fixtures/hook-fixture.ts
  • packages/svelte-table/tests/rendering.test.ts
  • packages/svelte-table/tests/ssr.test.ts
  • packages/svelte-table/tests/test-setup.ts
  • packages/svelte-table/tsconfig.json
  • packages/svelte-table/vite.config.ts

@KevinVandy
KevinVandy merged commit a4cae3c into beta Jul 29, 2026
10 checks passed
@KevinVandy
KevinVandy deleted the test/adapters-reactivity-test branch July 29, 2026 23:48
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.

2 participants