Skip to content

fix(angular): ensure table options updates are not missed during first mount window - #6534

Draft
riccardoperra wants to merge 2 commits into
mainfrom
codex/6530-fix
Draft

fix(angular): ensure table options updates are not missed during first mount window#6534
riccardoperra wants to merge 2 commits into
mainfrom
codex/6530-fix

Conversation

@riccardoperra

@riccardoperra riccardoperra commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

wip have to fix some tests


This pull request improves the reactivity and reliability of the injectTable function in the Angular Table package by ensuring that options updates are not missed and by making the handling of options more robust. It also adds a regression test for a previously reported issue and includes a minor test cleanup.

Reactivity and options handling improvements:

  • Switched to using Angular's computed to wrap the options function in injectTable, ensuring the latest options are always tracked reactively. [1] [2]
  • Refactored the effect logic in injectTable to avoid missing the initial options update and to prevent unnecessary updates when options haven't changed. This fixes a bug where the first options update could be dropped.

Testing improvements:

  • Added a regression test to ensure that options updates are not dropped before the effect first runs, addressing GitHub issue #6530.
  • Cleaned up a test by removing unnecessary object spreading for features in the options.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where table option updates made before the initial reactive update could be missed.
    • Ensured the latest data and configuration are preserved when a table is first initialized.
  • Tests
    • Added regression coverage for updates occurring before the first reactive effect runs.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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 Plus

Run ID: fa5bf6a9-90ef-4d03-9a1e-e007051b54f2

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
📝 Walkthrough

Walkthrough

injectTable now evaluates options with an Angular computed and applies changed option objects by identity. A regression test verifies that updates made before the first reactive effect are preserved.

Changes

Angular options synchronization

Layer / File(s) Summary
Computed option tracking
packages/angular-table/src/injectTable.ts
injectTable wraps the options initializer in a computed signal. Reactive updates compare the computed object with the previous object and call setOptions only when the identity changes.
Regression validation
packages/angular-table/tests/injectTable.test.ts, packages/angular-table/tests/angularReactivityFeature.test.ts, .changeset/early-tips-matter.md
The regression test verifies that pre-effect signal updates reach table.options.data. The test helper uses the shared feature object, and a patch changeset records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • TanStack/table#6458: Both changes address reactive table option synchronization during initial rendering.
  • TanStack/table#6528: Both changes update Angular injectTable option evaluation and related tests.

Suggested reviewers: kevinvandy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 and concisely describes the fix to prevent missed Angular table options updates during the first mount window.
Description check ✅ Passed The description clearly explains the reactivity changes, regression test, issue reference, and test cleanup, although it omits the template headings and checklist confirmations.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/6530-fix

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 Aug 9, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit e8ebb4a

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

☁️ Nx Cloud last updated this comment at 2026-08-09 16:09:30 UTC

@riccardoperra riccardoperra changed the title fix(angular): fix stale options during the effect first run fix(angular): ensure table options updates are not missed during first mount window Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 17 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/angular-table 9.1.2 → 9.1.3 Changeset
@tanstack/alpine-table 9.1.2 → 9.1.3 Dependent
@tanstack/angular-table-devtools 9.1.2 → 9.1.3 Dependent
@tanstack/ember-table 9.1.2 → 9.1.3 Dependent
@tanstack/lit-table 9.1.2 → 9.1.3 Dependent
@tanstack/match-sorter-utils 9.1.2 → 9.1.3 Dependent
@tanstack/octane-table 9.1.2 → 9.1.3 Dependent
@tanstack/preact-table 9.1.2 → 9.1.3 Dependent
@tanstack/preact-table-devtools 9.1.2 → 9.1.3 Dependent
@tanstack/react-table 9.1.2 → 9.1.3 Dependent
@tanstack/react-table-devtools 9.1.2 → 9.1.3 Dependent
@tanstack/solid-table 9.1.2 → 9.1.3 Dependent
@tanstack/solid-table-devtools 9.1.2 → 9.1.3 Dependent
@tanstack/svelte-table 9.1.2 → 9.1.3 Dependent
@tanstack/table-core 9.1.2 → 9.1.3 Dependent
@tanstack/table-devtools 9.1.2 → 9.1.3 Dependent
@tanstack/vue-table 9.1.2 → 9.1.3 Dependent
@tanstack/vue-table-devtools 9.1.2 → 9.1.3 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Aug 9, 2026

Copy link
Copy Markdown
More templates

@tanstack/alpine-table

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

@tanstack/angular-table

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

@tanstack/angular-table-devtools

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

@tanstack/ember-table

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

@tanstack/lit-table

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

@tanstack/match-sorter-utils

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

@tanstack/octane-table

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

@tanstack/preact-table

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

@tanstack/preact-table-devtools

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

@tanstack/react-table

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

@tanstack/react-table-devtools

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

@tanstack/solid-table

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

@tanstack/solid-table-devtools

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

@tanstack/svelte-table

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

@tanstack/table-core

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

@tanstack/table-devtools

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

@tanstack/vue-table

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

@tanstack/vue-table-devtools

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

commit: e8ebb4a

@riccardoperra
riccardoperra marked this pull request as ready for review August 9, 2026 09:26

@MILLERMARRU MILLERMARRU 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.

The mechanism here is solid. Wrapping _options in computed() is what makes the previousOptions === currentOptions reference check meaningful in the first place, calling the raw factory twice always returns two different object literals, so without the memoization the comparison would never be equal and every effect run would apply. With computed(), a real signal change is what produces a new reference, so the effect's very first run can now tell "options actually changed since I captured the initial snapshot" from "nothing changed, this is just the effect settling," instead of unconditionally skipping the first run like isMount did. Traced the timeline in #6530 and this correctly handles the specific race described there, an update that lands in the gap between construction and the effect's first flush is no longer silently dropped.

Worth being precise about scope though, since the changeset and the linked issue don't quite line up. #6530 describes two problems: the primary one is lazySignalInitializer.ts's queueMicrotask eager-init firing before Angular's input bindings are applied, throwing an uncaught NG0950 in test environments with an async beforeEach. The isMount swallow is called out as a secondary issue, one that only surfaces once you work around the first one. This PR only touches injectTable.ts, lazySignalInitializer.ts isn't part of the diff, so it fixes proposal (3) from the issue but not proposal (1). The reported symptom, the uncaught NG0950 in TestBed suites, is still there after this merges. Worth linking as "part of #6530" rather than "closes #6530", or the eager-init half is going to look resolved when it isn't.

@riccardoperra
riccardoperra marked this pull request as draft August 9, 2026 15:55
@MILLERMARRU

Copy link
Copy Markdown

Just went through the new commit, this closes the gap I mentioned earlier. queueMicrotask is gone from lazySignalInitializer.ts, so initialization now only happens through the Proxy traps, there's no more scheduled work that could race ahead of Angular applying the input bindings. Between that and the previousOptions comparison from the first commit, this now covers both halves of #6530, not just the swallowed-update part.

Traced through a few sequences by hand (options changing before the table is ever constructed, options changing right after) and the effect's if (!table) return guard combined with the reference comparison handles them correctly in all of them.

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