Repository navigation
feat: commit Router Link transition cues through scheduled work - #2107
Merged
domgan-oai merged 1 commit intoOct 15, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
October 15, 2026 21:34
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
87 other measured values are unchanged. Public-import reachability bundles (bytes)
117 other measured values are unchanged. |
11 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughflushSync, 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
flushSyncand 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.jsonRouter 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, andgit diff --checkpassed. 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.tshas 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:14483adds 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:7827creates a returned tuple per Link render. The click atpackages/tanstack-router/src/linkBinding.ts:301commits 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-Routerhooks-stateminimal 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 renamedflushSyncwould 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
compiled/MatchLifecycle.tsrx, Routercompiled/RouterProvider.tsrx, and Threeweb/events.ts. Run the website in Strong mode #2059 remains open.Provenance
agent-authored)Codex task · host
com-79386Need help on this PR? Tag
@codesmith-botwith 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
LinkswitchesisTransitioningfromflushSynctocommitIsTransitioning, sodata-transitioning, render-prop text, and co-located click updates are visible before synchronousrouter.navigate/onBeforeNavigatewhile other roots’ waiting transition work stays scheduled.linkBindingopts into Strong mode;@octanejs/tanstack-routerjoins 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.