Skip to content

feat: commit Router Link transition cues through scheduled work - #2107

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:feat/strong-router-link-transition
Oct 15, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:feat/strong-router-link-transition

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Router Link needs its transition cue and any updates from the Link's own click handler committed before router.navigate() emits synchronous callbacks. It previously forced the entire renderer through flushSync, including unrelated transition work waiting for a host task. The shared Link binding now uses an internal state-bound committed setter and opts into Strong mode. The setter enters the existing urgent scheduler/commit path; normal Link resolution still uses the ordinary batched setter.

A pending transition on the same owner follows the ordinary urgent promotion path. Other eligible urgent work and queued effects can still commit across roots, and the normal ViewTransition router decides which affected owners must be interrupted. This is deliberately narrower than all-priority flushSync and is not root-isolated. The Router peer range follows the paired Octane release that supplies the internal binding primitive, using the existing coordinated-core consumer policy.

Validation

  • pnpm format:check (repo-wide; scoped checks below)

  • pnpm typecheck (repo-wide; owning packages below)

  • pnpm test (repo-wide; relevant projects below)

  • pnpm exec octane-tsc -p packages/octane/tsconfig.json -p packages/tanstack-router/tsconfig.json

  • Router client, SSR, and differential projects: 121 tests passed. The strengthened compiled Link test observes the attribute, render-prop text, and ancestor menu state inside onBeforeNavigate; replacing the committed update with an ordinary setter fails all three observations.

  • Core dev/prod scheduler, transition task, and scoped ViewTransition selection: 164 passed; the expanded scoped ViewTransition suite then passed 58/58. Render/hydration exercise DOM adoption, synchronous cue and layout effects, ordinary setter batching, same-owner transition promotion, and unrelated waiting work. The same-owner regression failed before its fix. Direct active-capture and scoped-animation tests verify same-stack publication and preserve an unaffected animation; an all-priority flush negative control interrupts both scopes.

  • node --test scripts/workspace-packages.test.mjs (27 passed); the coordinated-release case failed before adding Router to the existing policy. pnpm sync, scoped format and type checks, and git diff --check passed. Explicitly selecting the existing Router test files also reports seven diagnostics identical to main after line-offset normalization; the owning package project excludes those test files and passes.

  • Website Strong analysis: 98 authored modules, zero diagnostics/ReactCompat boundaries; dependency frontier falls from four modules to three. linkBinding.ts has two non-blocking explicit-effect-dependency hints; its manually slotted ABI requires retaining those arrays.

  • Actual website compared against main 91dae8d739: production and development, desktop and 390×844 mobile viewport; direct SSR entry and live hydration, modifier-click/new tab, normal sidebar and keyboard pagination, history, active states, header navigation, focus-intent preload, Playground, and mobile menu close. Link activations caused no document reloads; no HTTP failures or browser warnings/errors. Candidate dev had one unattributed extra document request during initial startup before interaction, which did not recur on a warm direct entry. The final-source production rebuild had stable pre/post source hashes and a byte-identical 615-file public JS inventory to the browser-validated build. Website DOM identity was not instrumented.

  • perf-review: node scripts/perf-review-scan.mjs --base 91dae8d739 packages/octane/src/ packages/tanstack-router/src/ returned zero candidates. Hot path: packages/octane/src/runtime.ts:14483 adds one WeakMap lookup per opted-in Link render and one companion closure per hook lifetime; the normal state-cell shape is unchanged. packages/octane/src/runtime.server.ts:7827 creates a returned tuple per Link render. The click at packages/tanstack-router/src/linkBinding.ts:301 commits through the existing scheduler, with no new task poster, DOM read, or renderer queue. Complete website public JS inventory: 615 files on both sides; raw +320 B and sum of per-file gzip-9 +454 B. The no-Router hooks-state minimal bundle and behavioral snapshot are identical: 62,298 raw / 20,959 gzip / 19,043 brotli bytes. No interaction-latency claim.

  • concise-code: shipped source +76/-7 (Octane runtime/server +67/-0); one internal binding export and its server counterpart, plus a dedicated core behavioral fixture/test and changeset. Ordinary batching loses the same-stack cue; a root-isolated commit would add queue/effect partitioning; a renamed flushSync would preserve the compatibility boundary. Existing scheduler ownership is reused.

  • Current-head CI passed all 27 jobs, including 105 website and 620 Chromium tests. Attempt 1 failed one independent-island production hydration assertion; the same 54-test file passed locally and on the exact base CI. The fixture does not use the new hook, and its immediate fresh-click assertion can race passive replay cleanup. The failed-job rerun on the unchanged signed head passed the file 54/54 and the shard with 16,171 tests passed and 2 skipped. This is evidence of a likely timing race, not proof of a historical flake.

  • Benchmark: 64 work counters unchanged; 20 timings within noise (no speed-equivalence claim). Full-framework fixture +398 raw / +110 gzip / +163 Brotli bytes; three public-import compressed values +1–3 bytes, with the other 87 bundle and 117 reachability values unchanged. These diagnostic fixtures are separate from the complete website inventory above.

Risk / follow-ups

  • Unrelated deferred transition tasks no longer flush merely because a Link was activated. An ambient render/commit owns nested updates, as with the prior path. Eligible urgent cross-root work may commit.
  • The remaining website dependency frontier is Router compiled/MatchLifecycle.tsrx, Router compiled/RouterProvider.tsrx, and Three web/events.ts. Run the website in Strong mode #2059 remains open.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · host com-79386


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Touches scheduler commit ordering and router Link click timing; behavior is narrower than flushSync but still affects navigation-visible state and cross-root urgent flushes.

Overview
Adds __useCommittedState, an internal Octane binding hook whose third setter runs an urgent scheduler commit (without adopting unrelated deferred transition tasks) before integration callbacks observe DOM/state.

TanStack Router Link switches isTransitioning from flushSync to commitIsTransitioning, so data-transitioning, render-prop text, and co-located click updates are visible before synchronous router.navigate / onBeforeNavigate while other roots’ waiting transition work stays scheduled. linkBinding opts into Strong mode; @octanejs/tanstack-router joins the coordinated-core Octane peer policy (workspace:^).

Core and router tests cover render/hydration, ordinary setter batching, same-owner transition promotion, scoped ViewTransition interruption, and the strengthened compiled-router timing assertion.

Reviewed by Cursor Bugbot for commit b9b5ea8. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Oct 15, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 15, 2026 21:34
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 6 value(s) increased
  • 🔴 bundle-reachability: 3 value(s) increased

Compares 91dae8d73, the merge commit's first parent with 72c0e4666 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.967 3.567 −7.3% −14.2% … +14.9% ⚪ within noise
octane-tsrx replace 10.650 11.608 −4.7% −11.1% … +7.2% ⚪ within noise
octane-tsrx add 3.217 3.258 +0.0% −1.1% … +7.0% ⚪ within noise
octane-tsrx update 0.151 0.156 +3.4% −3.7% … +11.2% ⚪ within noise
octane-tsrx select 0.006 0.006 +0.5% −0.9% … +4.1% ⚪ within noise
octane-tsrx swap 0.021 0.021 −3.3% −9.4% … +6.1% ⚪ within noise
octane-tsrx remove 0.022 0.021 −2.3% −5.9% … +2.7% ⚪ within noise
octane-tsrx runlots 31.050 33.567 −2.2% −7.7% … +16.4% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 −3.2% −6.2% … +2.7% ⚪ within noise
octane-tsrx clear 65.750 64.525 +11.1% −3.0% … +21.2% ⚪ within noise
octane-jsx run 3.558 3.750 ±0.0% −2.6% … +2.8% ⚪ within noise
octane-jsx replace 7.867 7.875 −1.3% −6.1% … +1.4% ⚪ within noise
octane-jsx add 3.483 3.408 +3.0% −0.0% … +5.3% ⚪ within noise
octane-jsx update 0.275 0.270 +0.7% −0.7% … +3.5% ⚪ within noise
octane-jsx select 0.150 0.150 −0.9% −5.2% … +2.8% ⚪ within noise
octane-jsx swap 0.223 0.224 −0.5% −6.5% … +2.4% ⚪ within noise
octane-jsx remove 0.191 0.186 −0.7% −2.1% … +2.6% ⚪ within noise
octane-jsx runlots 68.342 70.317 −2.5% −17.4% … +10.7% ⚪ within noise
octane-jsx select_lots 2.254 2.362 −3.5% −16.3% … +9.9% ⚪ within noise
octane-jsx clear 46.792 45.208 −0.7% −3.2% … +3.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx full_fw_raw 571,403 571,801 +398 (+0.1%) 🔴
octane-tsrx full_fw_gzip 172,900 173,010 +110 (+0.1%) 🔴
octane-tsrx full_fw_brotli 145,583 145,746 +163 (+0.1%) 🔴
octane-jsx full_fw_raw 571,403 571,801 +398 (+0.1%) 🔴
octane-jsx full_fw_gzip 172,900 173,010 +110 (+0.1%) 🔴
octane-jsx full_fw_brotli 145,583 145,746 +163 (+0.1%) 🔴

87 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
binding-base-ui-esbuild brotli 61,477 61,480 +3 (+0.0%) 🔴
binding-aria-esbuild gzip 3,138 3,139 +1 (+0.0%) 🔴
binding-aria-esbuild brotli 2,805 2,808 +3 (+0.1%) 🔴

117 other measured values are unchanged.

@domgan-oai
domgan-oai merged commit 1924a92 into octanejs:main Oct 15, 2026
77 of 81 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant