Skip to content

fix(octane): render a pending cue at urgent priority (#1864) - #1899

Merged
trueadm merged 4 commits into
mainfrom
fix/transition-cue-ancestor
Oct 8, 2026
Merged

trueadm merged 4 commits into
mainfrom
fix/transition-cue-ancestor

Conversation

@trueadm

@trueadm trueadm commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes the remaining same-class gap after #1888: a pending cue in an ancestor of the component that holds the transition's state. The microtask flush now renders a pending cue at urgent priority, as React renders isPending and optimistic values in an urgent lane. A descendant whose transition is waiting shows its committed state in the cue's commit and renders the transition in the posted task.

Refs #1864 (does not close it).

Why

App owns const [isPending, start] = useTransition() and renders <List isPending={isPending} start={start} />. List owns the state that start(() => setFilter('b')) sets. The cue rendered App at transition priority in the click's microtask flush. renderBlockInner keeps a child with queued transition work on its committed cells only under an urgent parent, so the cue's render reached List and rendered its new state there. The browser could not paint the cue until the whole transition render had finished. #1888 fixed this only when the cue and the state share one component.

jsdom frames at the next two host-task boundaries, clicking with a MessageChannel marker posted first:

Frames
main (#1888) b pending, b idle
this PR a pending, b idle
React 19.2.7 a pending, b idle

Changes

  • runtime.ts, all inside the optional transition driver:
    • markTransitionCue, called by the three hooks that raise a cue (useTransition, useActionState, useOptimistic), records a cue scheduled outside a render, flush, flushSync or the transition task in TRANSITION_CUES. The marks are stamped with QUEUE_REINDEX_EPOCH and expire when a drain empties or reindexes QUEUE, so a stale mark can never reclassify later work. scheduleRender, drainQueue and queueTransitionBlock gain no code; since fix: coalesce and pace ready signal producers #1875, native readers share the task queue and so carry none of it.
    • splitsTransitionCue / splitTransitionCue: a pure cue renders at urgent priority. A pure cue is a marked block with no transition work of its own: not waiting in the task queue, no staged cells, no pending root request, and no Suspense/Activity owner at urgent priority. The existing urgent-ancestor exposure then keeps waiting descendants on their committed cells, and they keep their queue entries for the task. fix(octane): commit the pending cue apart from its component's transition (#1864) #1888's split path for a cue whose own block has waiting work is unchanged.
    • View Transition routing extends fix: publish Action cues before native transition capture #1872's Action-cue rule to every pure cue. A drain of cues alone starts no native capture. Transition work that rides with the cues (a root render, native signal work, staged state in this drain) keeps its capture. A cue split from its own block's waiting work still never qualifies (fix(octane): commit the pending cue apart from its component's transition (#1864) #1888). queuedTransitionCue no longer needs transition work to be waiting.
  • Contract changes, both React parity (React dispatches these cues as SyncLane optimistic updates):
    • a component that suspends while rendering the cue shows its boundary's fallback, where the cue used to be held;
    • a drain of cues alone, such as a useTransition async Action before its first update, starts no View Transition. fix: publish Action cues before native transition capture #1872 already did this for useActionState.
  • docs/differences-from-react.md §Scheduler: the cue paragraph now states that cues render at urgent priority, covers descendants, the Suspense and View Transition consequences, and when a cue keeps transition priority.
  • Changeset: octane patch.

Validation

  • packages/octane/tests/transition-flush-task.test.ts (--project octane): 40/40. 6 of the 7 new tests fail on main:
    • ancestor cue with useTransition, useOptimistic and useActionState (b pending / b saving / b 0 pending instead of a …);
    • the ancestor cue with a ViewTransition around the child's state (the cue rendered bbbb);
    • an async Action's cue starts no View Transition (also fails with only the queuedTransitionCue change reverted);
    • a suspending cue shows its fallback (main held it: goidle).
    • One pins neighbouring behavior and passes on both: the child's transition suspends in its task while the cue stays committed.
  • Related files, --project octane: 36 files, 711 tests, including every transition-* (fix: publish Action cues before native transition capture #1872's Action-cue capture cases in transition-task), view-transition*, actions, transitions, form-reset, conformance/async-actions, conformance/transitions-extra, differential/action-state, universal-scheduling. fix: publish Action cues before native transition capture #1872's "preserves a native signal capture alongside an Action cue" is what required keeping its cue-only rule instead of treating every pure cue as urgent work in routing.
  • packages/octane/tests/browser/transition-cue (--project octane-events-browser): the Sort fixture gains an ancestor variant (TransitionSortShell), compiled from the same .tsrx for Octane and React 19.2.7 (@tsrx/react). 4/4 pass; the Octane ancestor case fails on main (Sorting… commits with sorted: true).
  • pnpm typecheck:files on the changed files; pnpm format:files:check; pnpm sync clean.
  • pnpm test, full pnpm typecheck, pnpm format:check: left to CI (repo rule: no wide local runs while parallel sessions share the machine).

Chromium Event Timing (cue in the ancestor, memoized 40 ms list, 5 clicks, Event Timing ≥ 16 ms)

CPU main this PR React 19.2.7
1× 5/5 slow clicks: 64, 40, 40, 40, 40 ms 1/5: 24 ms (first, cold) 1/5: 24 ms (first, cold)
4× 5/5: 80, 48, 48, 40, 40 ms 1/5: 32 ms (first, cold) 1/5: 32 ms (first, cold)

The same-component variant (#1888) measures the same before and after: 1/5 at 24 ms (1×) and 32–40 ms (4×), as React does.

Perf review: fix/transition-cue-ancestor (main..HEAD)

Scan: node scripts/perf-review-scan.mjs → 0 candidates.
Hot paths touched: markTransitionCue (once per cue publish, from the three cue hooks), splitTransitionCue (per drained block once the transition root driver is installed), splitsTransitionCue/queuedTransitionCue (per transition-priority queued block during drain and View Transition routing). scheduleRender, queueTransitionBlock, renderBlockInner, drainQueue and the Block shape are unchanged. CI's js-framework report: all 64 work counters unchanged.

# Severity Location Dimension Finding Required evidence Provided?
1 needs-evidence runtime.ts splitTransitionCue scheduling An ancestor cue now renders a waiting descendant once over its committed cells in the microtask, and again in the task. React renders it twice in the same order. marker-task commit order; Chromium Event Timing yes (tests, table above)
2 needs-evidence driver reachability bundle +100 raw in apps that start transitions, 0 elsewhere (native-reader apps included) CI bundle rows local rows below; CI authoritative
3 note splitTransitionCue allocation No new allocation per render. TRANSITION_CUES grows once and is reused. The exposure record for a waiting descendant is the existing UrgentTransitionRender path. — —
4 note splitTransitionCue scheduling One epoch compare per drained block in transition apps, which releases stale marks — —

benchmarks/transition-hooks (OCTANE_TRANSITION_TIMING=0): all 42 work-model rows and every render, runtime function/array/object/constructor and Map.get counter are identical. Only bundle_minified +146 and bundle_gzip +52 move.

Bundle rows (local, against main)

Rows raw gzip
suspense-transition, binding-base-ui-*, binding-radix-*, binding-apollo-client-* +100 +21 to +41
bindings/octane-tsrx fw / octane-* ceiling — +18 / +62
every other minimal and app row 0 0

These exceed the 32-byte headroom on 11 rows (+100 raw on each transition row, plus binding-base-ui-* gzip). The raise lands in the budget-only companion PR #1905, which merges immediately before this one; the bundle size check stays red here until then. #1905 is raise-only against main's current caps, after #1888's own raise landed on main (87d9f95b4c, which supersedes #1887).

Risk / follow-ups

  • Two contract changes, both React parity and documented in §Scheduler: a suspending cue now shows its fallback instead of being held, and a cue-only drain no longer starts a View Transition.
  • fix: publish Action cues before native transition capture #1872's VT_ACTION_CUE flag stays. It still covers an Action cue that keeps transition priority (one started during a render or a commit). A follow-up could fold it into the pure-cue marks.
  • Nested pure cues (an ancestor and a descendant cue hook in one batch): the descendant renders twice in the microtask, because the exposure re-pends it. On main it rendered once. This needs both hooks in one transition batch, so it is rare. It is not deduplicated here, to keep the bytes down.
  • A cue keeps transition priority, as before, when it starts during a render, a commit, flushSync or the transition's task, and while hydration reindexes the queue.
  • isPending's falling edge is still a separate commit right after the transition render, in the same task (fix(octane): commit the pending cue apart from its component's transition (#1864) #1888's residual).

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


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


Note

Medium Risk
Changes core transition scheduling and View Transition eligibility in runtime.ts; behavior shifts for ancestor cues, cue-only commits, and suspending cues, though heavily regression-tested against React parity.

Overview
Fixes #1864 for pending transition cues owned by an ancestor of the component whose state the transition updates. useTransition / useActionState isPending and useOptimistic now call markTransitionCue so the microtask flush treats them as urgent (like React’s urgent lane): descendants with queued transition work keep committed state in that commit and finish the transition in the posted host task.

View Transition routing is tightened so a cue-only drain (e.g. async Action before its first update) does not start native capture; real transition work that commits with the cue still captures. A cue that suspends now shows the boundary fallback instead of being held.

Docs §Scheduler and new jsdom + Chromium tests cover ancestor shells, optimistic/action cues, ViewTransition around child state, and suspending cue content; the Sort browser fixture adds an ancestor variant.

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

A useTransition or useActionState raising isPending, or a useOptimistic
value, rendered at transition priority in the click's microtask flush.
When that render reached a descendant whose state the transition sets,
the descendant rendered its new state there too, so the browser could not
paint the cue until the whole transition render finished. React renders
the cue in an urgent lane, where that descendant shows its committed
state, and renders the transition in a later Scheduler task.

The microtask flush now renders a pure cue (one with no transition work of
its own) at urgent priority. renderBlockInner's existing urgent-ancestor
exposure keeps descendants with waiting transition work on their committed
cells, and they keep that work for the transition task. The cue marks live
in the transition driver (TRANSITION_CUES) and are scoped to the queue
epoch, so apps that never start a transition carry no new bytes.

View Transition routing extends #1872's Action-cue rule to every pure cue:
a drain of cues alone starts no capture, and transition work that rides
with them (a root render, native signal work, staged state) keeps it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 8, 2026
@trueadm
trueadm marked this pull request as ready for review October 8, 2026 14:11
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • ❌ bundle-size: 2 value(s) exceed their committed budget
  • ❌ bundle-reachability: 9 value(s) exceed their committed budget
  • 🔴 bundle-size: 10 value(s) increased within budget
  • 🔴 bundle-reachability: 11 value(s) increased within budget

Compares 87d9f95b4, the merge commit's first parent with 7d03a2ef6 on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. 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 2.617 2.625 +0.0% −5.9% … +6.9% ⚪ within noise
octane-tsrx replace 7.592 7.450 −1.8% −4.9% … +6.0% ⚪ within noise
octane-tsrx add 2.467 2.492 ±0.0% −4.0% … +4.0% ⚪ within noise
octane-tsrx update 0.137 0.137 +3.3% −1.9% … +4.7% ⚪ within noise
octane-tsrx select 0.006 0.006 +0.3% −1.2% … +3.0% ⚪ within noise
octane-tsrx swap 0.030 0.030 ±0.0% −1.5% … +1.6% ⚪ within noise
octane-tsrx remove 0.015 0.016 +1.2% −1.3% … +2.5% ⚪ within noise
octane-tsrx runlots 27.083 26.325 −0.7% −2.9% … +0.6% ⚪ within noise
octane-tsrx select_lots 0.006 0.007 +4.3% −1.3% … +6.5% ⚪ within noise
octane-tsrx clear 53.500 57.583 +3.8% −1.7% … +12.6% ⚪ within noise
octane-jsx run 4.683 5.233 ±0.0% −9.3% … +3.6% ⚪ within noise
octane-jsx replace 13.625 13.333 −9.1% −16.5% … +21.6% ⚪ within noise
octane-jsx add 4.242 3.967 −3.1% −8.4% … ±0.0% ⚪ within noise
octane-jsx update 0.391 0.350 +0.4% −7.8% … +9.2% ⚪ within noise
octane-jsx select 0.261 0.256 +4.1% −5.2% … +10.0% ⚪ within noise
octane-jsx swap 0.371 0.348 +0.4% −7.7% … +6.1% ⚪ within noise
octane-jsx remove 0.288 0.291 +1.7% −7.7% … +8.5% ⚪ within noise
octane-jsx runlots 49.558 40.558 −9.0% −20.9% … −0.8% ⚪ within noise
octane-jsx select_lots 3.160 3.168 +4.7% −13.5% … +23.7% ⚪ within noise
octane-jsx clear 84.217 89.208 −2.4% −10.1% … +13.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

❌ 2 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").

target metric head budget over
octane-tsrx bindings_fw_raw 341,323 341,255 +68
octane-tsrx bindings_js_raw 688,961 688,893 +68
target metric base head Δ
octane-tsrx bindings_js_raw 688,861 688,961 +100 (+0.0%) 🔴
octane-tsrx bindings_js_gzip 225,037 225,056 +19 (+0.0%) 🔴
octane-tsrx bindings_js_brotli 191,253 191,259 +6 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 96,224 96,260 +36 (+0.0%) 🔴
octane-tsrx bindings_fw_raw 341,223 341,323 +100 (+0.0%) 🔴
octane-tsrx bindings_fw_gzip 109,371 109,390 +19 (+0.0%) 🔴
octane-tsrx bindings_fw_brotli 95,029 94,999 −30 (−0.0%) 🟢
octane-tsrx full_fw_raw 568,692 568,925 +233 (+0.0%) 🔴
octane-tsrx full_fw_gzip 171,259 171,325 +66 (+0.0%) 🔴
octane-tsrx full_fw_brotli 144,030 144,190 +160 (+0.1%) 🔴
octane-jsx full_fw_raw 568,692 568,925 +233 (+0.0%) 🔴
octane-jsx full_fw_gzip 171,259 171,325 +66 (+0.0%) 🔴
octane-jsx full_fw_brotli 144,030 144,190 +160 (+0.1%) 🔴

47 other measured values are unchanged.

Public-import reachability bundles (bytes)

❌ 9 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").

target metric head budget over
suspense-transition raw 141,673 141,605 +68
binding-base-ui-vite raw 199,872 199,804 +68
binding-base-ui-vite gzip 62,822 62,819 +3
binding-base-ui-esbuild raw 215,403 215,335 +68
binding-base-ui-esbuild gzip 69,791 69,786 +5
binding-radix-vite raw 201,907 201,839 +68
binding-radix-esbuild raw 217,227 217,159 +68
binding-apollo-client-vite raw 342,324 342,256 +68
binding-apollo-client-esbuild raw 365,546 365,478 +68
target metric base head Δ
suspense-transition raw 141,573 141,673 +100 (+0.1%) 🔴
suspense-transition gzip 44,764 44,792 +28 (+0.1%) 🔴
suspense-transition brotli 39,289 39,311 +22 (+0.1%) 🔴
binding-base-ui-vite raw 199,772 199,872 +100 (+0.1%) 🔴
binding-base-ui-vite gzip 62,787 62,822 +35 (+0.1%) 🔴
binding-base-ui-vite brotli 54,639 54,652 +13 (+0.0%) 🔴
binding-base-ui-esbuild raw 215,303 215,403 +100 (+0.0%) 🔴
binding-base-ui-esbuild gzip 69,754 69,791 +37 (+0.1%) 🔴
binding-base-ui-esbuild brotli 60,516 60,563 +47 (+0.1%) 🔴
binding-radix-vite raw 201,807 201,907 +100 (+0.0%) 🔴
binding-radix-vite gzip 63,396 63,411 +15 (+0.0%) 🔴
binding-radix-vite brotli 55,115 55,075 −40 (−0.1%) 🟢
binding-radix-esbuild raw 217,127 217,227 +100 (+0.0%) 🔴
binding-radix-esbuild gzip 70,304 70,330 +26 (+0.0%) 🔴
binding-radix-esbuild brotli 61,085 61,125 +40 (+0.1%) 🔴
binding-apollo-client-vite raw 342,224 342,324 +100 (+0.0%) 🔴
binding-apollo-client-vite gzip 105,071 105,101 +30 (+0.0%) 🔴
binding-apollo-client-vite brotli 91,758 91,837 +79 (+0.1%) 🔴
binding-apollo-client-esbuild raw 365,446 365,546 +100 (+0.0%) 🔴
binding-apollo-client-esbuild gzip 116,092 116,122 +30 (+0.0%) 🔴
binding-apollo-client-esbuild brotli 101,250 101,338 +88 (+0.1%) 🔴

90 other measured values are unchanged.

Resolve with #1875: splitCue/splitsCue moved to TRANSITION_ROOT_DRIVER, and
the task queue now also takes native producer refreshes. The cue marks move
out of queueTransitionBlock into the three hooks that raise a cue
(markTransitionCue), so native-reader apps that reach the shared task queue
carry none of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit b4a61e7 into main Oct 8, 2026
47 of 56 checks passed
@trueadm
trueadm deleted the fix/transition-cue-ancestor branch October 8, 2026 15:25
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 fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant