Repository navigation
fix(octane): commit the pending cue apart from its component's transition (#1864) - #1888
Conversation
…tion (#1864) When the component that raises isPending also held the transition's own update, both rendered together in the click's microtask flush: the cue showed the new state, and the browser could not paint "pending" until the whole transition render had finished. That is the canonical useTransition pattern (the docs' ProjectTabs example, the playground's Sort button). React renders isPending in an urgent lane with the previous state and the transition's update later, in a Scheduler task. A pending cue now never renders transition work that waits for the task. When a transition update flushes for a block already queued for its cue (flushTransitionActionBatch), or a cue arrives for a block whose transition is waiting (upgradeTransitionBlock), the block is queued in both places. The microtask drain renders only the cue (splitTransitionCue), at urgent priority over the block's committed cells, through the exposure an urgent ancestor already uses for a child with a queued transition, then leaves the block pending for the transition task. Suspense holds after the cue, useOptimistic, urgent updates during the wait (which still render the transition with them), flushSync, act(), unmount and controlled inputs keep their behavior. A split cue renders outside a View Transition and leaves addTransitionType types to the transition's render. beginUrgentTransitionRender no longer reverts a hook cell whose queue a render already consumed, which could flash a committed transition value back, and no longer allocates a slot index or predicate closure per call. An urgent ancestor that already rendered a split cue spares the block's own queue entry a second render. Chromium Event Timing on the Sort pattern (memoized 40 ms list, 5 clicks): main 5/5 slow clicks (40-80 ms); now 1/5 (first, cold), matching React 19.2.7. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shard 1/4 fails its byte budgets until #1887 merges, and fail-fast then cancels shards 2-4. This commit only lets those shards report; it is reverted before merge, and the raise lands through #1887. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Stale deferred cells revert on later cues
- Added slot.renderTransition as a liveness marker for non-hook transition entries (mirroring the existing cell.renderTransition for hooks), set it during flushTransitionActionBatch, cleared it when useDeferredValue reads its value in a transition render and at flushWork-end, and guarded hasQueuedTransitionCells and beginUrgentTransitionRender against committed entries.
Preview
diff --git a/packages/octane/src/runtime.ts b/packages/octane/src/runtime.ts
--- a/packages/octane/src/runtime.ts
+++ b/packages/octane/src/runtime.ts
@@ -3132,7 +3132,8 @@
if (!changed && !forceRender && update.previous === undefined) continue;
if (changed) slot.value = value;
if (update.reducer !== undefined) update.reducer.renderTransition = update;
- if (update.state !== undefined) update.state.renderTransition = update;
+ else if (update.state !== undefined) update.state.renderTransition = update;
+ else update.slot.renderTransition = update;
// Queue replay can still be required after an urgent replacement already
// published the staged value. That bookkeeping is not a state-change cause;
// reducers retain their explicit forced-render cause.
@@ -3353,6 +3354,15 @@
/** Flushed sync-transition updates retained for the drain, one group per batch. */
let FLUSHED_TRANSITION_UPDATES: Array<Array<TransitionActionUpdate<any>>> = [];
+function clearNonHookRenderTransitions(): void {
+ for (const entries of FLUSHED_TRANSITION_UPDATES) {
+ for (const entry of entries) {
+ if (entry.state === undefined && entry.reducer === undefined)
+ entry.slot.renderTransition = undefined;
+ }
+ }
+}
+
interface WarmHarvestEntry {
slot: HookSlot;
deps: any[];
@@ -7781,7 +7791,12 @@
for (const update of entries) {
if (update.block !== block || update.superseded) continue;
const cell = update.state ?? update.reducer;
- if (cell === undefined || cell.renderTransition !== undefined) return true;
+ if (
+ cell !== undefined
+ ? cell.renderTransition !== undefined
+ : update.slot.renderTransition !== undefined
+ )
+ return true;
}
}
return false;
@@ -8677,8 +8692,10 @@
if (
(clearRetainedTransitionUpdates || FLUSHED_TRANSITION_UPDATES.length > 0) &&
TRANSITION_QUEUE.length === 0
- )
+ ) {
+ clearNonHookRenderTransitions();
FLUSHED_TRANSITION_UPDATES.length = 0;
+ }
if (typeof __OCTANE_PROFILE_ENABLED__ !== 'undefined' && __OCTANE_PROFILE_ENABLED__)
__devtoolsNotifyFlush();
if (clearViewTransitionTypes) viewTransitionDriver!.clearTypes();
@@ -11944,13 +11961,22 @@
for (const entries of FLUSHED_TRANSITION_UPDATES) {
for (const update of entries) {
if (update.block !== block || update.superseded) continue;
+ if (
+ update.state === undefined &&
+ update.reducer === undefined &&
+ update.slot.renderTransition === undefined
+ )
+ continue;
// A block has few staged cells, so a scan beats allocating a slot index.
let previous = 0;
while (previous < cells.length && cells[previous].update.slot !== update.slot) previous++;
if (previous < cells.length) {
// State/reducer entries retain their preceding operation chain. Plain
- // deferred cells still need the earliest committed value below.
+ // deferred cells use the latest entry's base (the committed value before
+ // this transition, not one from an earlier committed transition).
cells[previous].update = update;
+ if (update.state === undefined && update.reducer === undefined)
+ cells[previous].baseValue = update.baseValue;
} else {
cells.push({
update,
@@ -44355,7 +44381,11 @@
s.next = value;
const wasHidden = s.wasHidden;
s.wasHidden = hidden;
- if (Object.is(s.value, value)) return s.value;
+ if (Object.is(s.value, value)) {
+ if (s.renderTransition !== undefined && block.currentRenderMode === 'transition')
+ s.renderTransition = undefined;
+ return s.value;
+ }
// Hidden-prerender update, or the first render after a hidden→visible
// reveal: React treats the (re)appearing tree as a fresh mount for this
// hook — there is no on-screen "previous" value to defer to
@@ -44377,6 +44407,7 @@
// values update in the same paint.
if (block.currentRenderMode === 'transition') {
s.value = value;
+ s.renderTransition = undefined;
return value;
}
if (!s.scheduled && !hasHeldDeferredSwap(s)) spawnDeferredSwap(s);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit fdb2de9. Configure here.
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)❌ 18 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").
11 other measured values are unchanged. Public-import reachability bundles (bytes)❌ 40 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").
37 other measured values are unchanged. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 6141db3 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 01:15 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 6141db3 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 01:18 PM |
FLUSHED_TRANSITION_UPDATES is retained while any block waits for the transition task, so a block's already-rendered updates can still be listed when a later pending cue splits on that block. Hook cells were guarded by their consumed renderTransition, but plain cells (useDeferredValue's swap, useLinkedState) were reverted to their pre-transition base: the cue flashed the deferred value from before the swap. When a block that is not queued is scheduled at transition priority, a render has consumed every update retained for it, so queueTransitionBlock marks them rendered and the cue's committed-cell exposure skips them. A hold that takes the entries clears the mark, so hold and promotion behave as before. Reported by Cursor Bugbot on #1888. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reverted with fdb2de9 before merge; the raise lands through #1887. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1888 now also marks retained transition updates its block already rendered, so a later split cue cannot expose a committed plain cell's base: about +128 raw and +45 gzip on the nine transition scenarios. Values from --write-budgets on #1888's head. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # benchmarks/bundle-size/minimal-budgets.json # docs/differences-from-react.md # packages/octane/src/runtime.ts
…sition's capture #1872 pinned the old same-root order, where the Action cue and the explicit transition state in one component rendered together in the microtask flush and shared its native capture. The cue now renders apart from that state, as in the separate-root case: it commits without a capture, and the state is captured when its task renders it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bundle-size gates now run in their own job (#1889), so the runtime shards no longer need the raised budgets to run. The raise lands through #1887. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The merge took main's budget files. Each raw and gzip row that main (abe9b42) fits drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 24 lowers and no raises. Main measures over 35 rows after #1875 and #1888, and #1887 budgets that growth. Those rows keep main's values here. Merging #1887 will re-lower the ones this change also saves on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…udgets #1888 (the split transition cue) merged ahead of its budget-only raise #1887, so main's transition-using rows exceed their ceilings. #1893 has since raised budgets for #1892, which is still open, but measured without #1888's growth. Raise only the 30 rows still over their ceilings on main 1e74902, to measured + 32 raw/gzip (+ 256 brotli) from run-minimal.mjs and run.mjs --write-budgets, and keep every other value, including #1893's pending raises: - suspense-transition, Base UI, Radix and Apollo bindings, bindings app: about +1.12 to +1.15 kB raw, +0.30 to +0.37 kB gzip - hydrate-frame +63 raw / +37 gzip; root-static brotli +279 The 62 rows #1893 raised stay above their ratchet floor until #1892 lands. This supersedes #1887. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a row (#1890) * perf(octane): copy a keyed reorder's record directly until it relinks a row A keyed reorder records its list at the first row index it rewrites, before it knows whether it will relink a few rows or every row. Since #1833 that record allocated its `links` Map and a per-journal records Map up front. When the reorder then reached the LIS path, `fullForSlotRecord` walked the chain through the empty links Map and, for a key Map already out of chain order, built a Set of every row to filter it. The record now gets its links Map at its first relink (`forSlotLinks`). Until then only index writes have run, which change neither the chain nor the key Map, so converting it copies the list as it stands, which is the full form's cost before #1833. The record rides in the spare slot of its own undo entry, found again through the window's `seen` index, so `SLOT_RECORDS` is gone and the record still lives exactly as long as its log. - recursive-context zero-context reorder: 4 Map constructions -> 2, so context-cache-work.mjs passes its ceiling again (bisected to e595a13). - js-framework reorder matrix (octane-tsrx, paired, 12 samples): rotatef, rotateb and displace3-8 are 22-27% faster than main and within 5% of the runtime before #1833; removals and inserts keep #1833's gains. - Framework bundles are 129-137 raw bytes smaller; budgets lowered. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(octane): look a keyed list's record up only when its window has an entry The PR bench counted two more production calls on every js-framework operation: journalForSlot and journalForOwnedListClear called the record lookup, and fullForSlotRecord with no record, even for a list's first record in a render, where there is no entry to find. Skip both when the list has no entry. Every js-framework calls_* and dom_* counter now equals main's (pair.mjs --work-only). Lower the bindings app and total brotli budgets the ratchet now asks for. Co-Authored-By: Claude Opus 5.5 <[email protected]> * perf(octane): read a keyed list's record from its undo entry inline Inline the record lookup in journalForSlot and journalForOwnedListClear. With the helper, the bindings app's framework chunk compressed 21 gzip bytes larger than main's, past its budget, although raw was 104 bytes smaller. Inline, it is 5 gzip bytes larger and 10 under the budget. Production calls are unchanged: every js-framework calls_* and dom_* counter equals main's (pair.mjs --work-only against c0192ec). Re-measure the bundle budgets on current main. The merges took main's budget files, and this writes 40 lowers and no raises. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): lower the budgets by this change's measured saving over #1891 The merge took main's budget files. #1891 raised 70 rows ahead of #1875, which is still open. Each raw and gzip row now drops by exactly what this change saves against main (2f81266), measured per scenario on both trees. A row #1891 raised therefore keeps #1875's headroom. Brotli rows keep main's values, and no value is raised. Every head measurement fits its budget. The ratchet flags only the 70 rows #1891 raised for #1875, as it does for any PR until #1875 lands. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-lower the budgets this change saves on after #1875 landed The merge took main's budget files. Each raw and gzip row that main (abe9b42) fits drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 24 lowers and no raises. Main measures over 35 rows after #1875 and #1888, and #1887 budgets that growth. Those rows keep main's values here. Merging #1887 will re-lower the ones this change also saves on. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-lower the budgets this change saves on over #1893 The merge took main's budget files (6eef1e0). Each raw and gzip row that main fits drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 37 lowers and no raises. The rows #1893 raised for #1892 keep #1892's growth. The 30 rows main exceeds until #1887 lands keep main's values. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-lower the budgets this change saves on over 87d9f95 The merge took main's budget files. Main now fits every row. Each raw and gzip row drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 63 lowers and no raises. The rows #1893 raised for #1892 keep #1892's growth. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): lower the budgets by this change's saving over main's ratchet The merge took main's budget files. e14fbdf set every budget to main's measured bytes plus headroom. Each raw and gzip row drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 56 lowers and no raises. Every ceiling and the ratchet hold locally, and so do the budget-raise and hydration-free checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): lower the budgets by this change's saving after #1892 The merge took main's budget files (68aa481), which match main's measured bytes. Each raw and gzip row drops by exactly what this change saves against main, measured per scenario on both trees. Brotli rows keep main's values unless the ratchet asks for less. That gives 54 lowers and no raises. Locally, binding-mantine-hooks-esbuild brotli is 7 bytes over main's value, 27,265 against 27,258. Its raw and gzip bytes equal main's: esbuild assigns different minified names in that bundle, and brotli compresses them differently. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: domgan-oai <[email protected]>


Summary
Closes the G1 gap that #1873 documented for #1864. When the component that raises
isPendingalso holds its transition's own update, the pending cue now commits with the previous state. The transition renders in its posted task, as React rendersisPendingin an urgent lane before the transition lane. This is the canonicaluseTransitionpattern, used by the docs'ProjectTabsexample and the playground's Sort button.Refs #1864 (does not close it).
Why
Octane keeps one live tree, and the transition's cell was already written when the cue rendered. So the cue and the transition rendered together in the click's microtask flush, and the browser could not paint "Sorting…" until the whole transition render had finished. jsdom commit log for
const [isPending, start] = useTransition(); const [tab, setTab] = useState('a'), clickingstart(() => setTab('b'))with aMessageChannelmarker posted first:maina idle,b pending,b idle, taska idle,a pending, task,b pending,b idlea idle,a pending, task,b idleThe frames a browser can paint are the same as React's:
a pendingat the first task boundary andb idleat the next. The remaining difference isisPending's falling edge. It still commits right after the transition render, in the same task and before the next frame, as it already does onmainwhen the cue and the transition live in different components (see Risk).Changes
upgradeTransitionBlock: outside a flush, a pending cue never takes transition work out of the task queue.flushTransitionActionBatch) also waits inTRANSITION_QUEUE.drainQueue→splitTransitionCue: the microtask flush renders such a block's cue alone, at urgent priority, over its committed cells (renderTransitionCue). It reuses the exposure an urgent ancestor already applies to a child with a queued transition (beginUrgentTransitionRender), then leaves the block pending for the task.queueAllTransitionandshouldClearTypesAfterFlush. It no longer starts a View Transition of its own, which the transition's real animation would then wait behind. It also no longer clears the transition'saddTransitionTypetypes.beginUrgentTransitionRenderfixes:Map, andendUrgentTransitionRenderno longer allocates a predicate closure, per call.ee54d6151b).FLUSHED_TRANSITION_UPDATESstays retained while any block waits for the task. When a block that is not queued is scheduled at transition priority, a render has consumed every update retained for it, soqueueTransitionBlockmarks those entriesrendered, and the cue exposure skips them. Without this, a later split cue flashed a committeduseDeferredValueoruseLinkedStatevalue back to its base. A hold clears the mark when it takes the entries.docs/differences-from-react.md§Scheduler: dropped the "both render together" caveat and stated the new rule and its exceptions. Also fixed the ResizeObserver sentence fix(octane): render transition-priority work in a later task #1873 left stale (startTransitionnow does move transition-only work out of the delivery loop).ProjectTabsprose, and the playground Sort comment (claimed useTransition "keeps the UI responsive while a heavy update commits").benchmarks/transition-hooks: thecycle,updaterandheldcontrols pinned the old order (cue with the new value). They now expect the cue with the committed value. Work model and README updated (see Performance).octanepatch.Validation
packages/octane/tests/transition-flush-task.test.ts(--project octane): 33/33, plus fix: publish Action cues before native transition capture #1872'stransition-task.test.ts16/16. 10 of the 16 new tests fail onmain:beginUrgentTransitionRenderfix reverted: the cue showsa1instead ofb1);renderedmarking disabled: the cue showsb/a/xinstead ofb/b/x);useOptimistic, unmount before the task, and View Transition plus types (each VT routing change reverted on its own fails it too).flushSync, awaitedact(), and controlled input.0fefe82260).packages/octane/tests/browser/transition-cue(--project octane-events-browser). It runs the same.tsrxfixture under Octane and React 19.2.7 (compiled with@tsrx/react): the Sort pattern, withisPendingandsortedin one component and a memoized slow list. It asserts the first commit isSorting…with the unsorted list, and that the click's Event Timing latency is under half the list's cost. It passes for both runtimes and fails onmain(Sorting…commits withsorted: true).pnpm typecheck:fileson the changed TS/TSRX files;pnpm format:fileson changed files;pnpm syncclean.pnpm test, fullpnpm typecheck,pnpm format:check: left to CI (repo rule: no wide local runs while parallel sessions share the machine).Chromium Event Timing (Sort pattern, memoized 40 ms list, 5 clicks, Event Timing ≥ 16 ms)
mainCommit sequence for one click, same page: React
Sort→Sorting…/unsorted →Unsort/sorted. This PR:Sort→Sorting…/unsorted → (task)Sorting…/sorted →Unsort/sorted. The last two commits share one task. The slow list renders once, in the task, as in React.Performance
transition-hooks(OCTANE_TRANSITION_TIMING=0 node benchmarks/bench.mjs --ratios transition-hooks): all 42 guards pass with the updated work model. Creation events per 64 cycles against823e100dd:Map.getcycleupdaterheldurgentdispatch,bail,clickdispatch).MessageChannel, follow-up list).mainnever posted a task for this pattern.Bundle (
run-minimal.mjs --budgets,run.mjs --budgets octane-tsrx octane-jsx):cli-spa-starter, measured onmainc0192ec816). The new code sits behind the transition task driver; the always-reachable part is one optional-chained driver call indrainQueue.mainhad only 7 bytes of raw headroom left on that row, so these rows need the raise too.bundle sizejob, so this branch no longer carries the budgets (the temporary carry is dropped in6141db30fa). That job stays red here until ci(bundle-size): budget combined transition cues and native producers #1887 merges; the runtime shards run regardless.js-framework: no transitions, so the transition driver is null.
drainQueuemakes no new call, andrenderBlockis still called once per drained block through a local. Call and DOM-mutation counters should be identical; see the PR bench report.perf-review
Scan:
node scripts/perf-review-scan.mjs→ 1 candidate.Hot paths touched:
drainQueue: per queued block per flush, one optional-chained call only when the transition driver is installed.flushTransitionActionBatch: per transition update, +1 driver call.begin/endUrgentTransitionRender: per urgent render over queued transition work, now also per split cue, with fewer allocations than before.queueAllTransition/shouldClearTypesAfterFlush: View Transition apps only, a predicate per transition-mode queued block while the task queue is non-empty.scheduleRenderis unchanged. No Block/Scope fields, no DOM reads, no new task poster (the existingscheduleTransitionTask→postHostTask).packages/octane/src/runtime.ts:7703benchmarks/transition-hooks/run.mjsDismissed:
runtime.ts:7703[microtask-hop]. It is the standard!scheduled-guarded flush arm, one per burst; it renders the cue once and does no per-value work.Risk / follow-ups
isPendingstill falls in a commit of its own right after the transition render, in the same task, never painted. React folds it into the transition render. Onmainthe cross-component case already works this way. Folding it needs a design for per-boundary Suspense holds in Octane's one-walk commit: a sibling that holds after the component committed "idle" would leave it wrong.queueAllTransitionis resolved with the split-cue check first in the loop, before fix: publish Action cues before native transition capture #1872's cue-only receipt check, which would otherwise count a split block's staged cells as work this drain renders. Both test files pass on the merge.mainup to7540c3552e. A merge with the currentmain(c0192ec816) is conflict-free (git merge-tree). The app's sync tool declined it until this repo's pinned git origin is confirmed, because that merge touches.claude/skills.root.render, or when the waiting work is not hook state. This is documented in §Scheduler.transition-hooksdid.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
High Risk
Changes core transition scheduling and commit ordering in
runtime.ts, affectinguseTransition,useOptimistic, View Transitions, and Suspense holds; extra render per transition may break tests that assumed the old cue+update flush.Overview
Fixes #1864: when one component owns both
isPendingand the state its transition updates (the canonicaluseTransitionpattern), Octane no longer commits the pending cue and the new state in the same microtask flush.Scheduling: The pending cue now renders urgently with committed/previous hook values (
renderTransitionCue,splitTransitionCue, revisedupgradeTransitionBlock). The transition’s real update stays onTRANSITION_QUEUEand runs in the existing posted host task. Same idea applies touseOptimisticcues and cues that arrive while a transition is already waiting. Urgent updates,flushSync, andact()behavior is preserved; Suspense/Activity holds and non–hook transition work can still combine renders.View Transitions: Split cues are treated as urgent—no native capture on the cue alone, and
addTransitionTypetypes wait for the transition task (queueAllTransition,shouldClearTypesAfterFlush).Correctness:
TransitionActionUpdate.renderedandbeginUrgentTransitionRenderfixes avoid flashing back committed or deferred values on later cues.Validation & docs: Expanded
transition-flush-tasktests, new Chromiumtransition-cuetest (Octane vs React 19.2.7, Event Timing), updatedtransition-hooksbenchmarks/work model (+1 render per cycle in affected scenarios), and scheduler/docs/website copy for the new commit order.Reviewed by Cursor Bugbot for commit 6141db3. Bugbot is set up for automated code reviews on this repo. Configure here.