Repository navigation
fix(octane): drop isPending in the transition's own render (#1864) - #1911
Conversation
React's transition lane carries `setPending(false)` with the transition's own updates, so `isPending` falls in the commit that shows them. Octane published the falling edge from a follow-up after the transition task's flush: a second render and commit in that task. A component holding both `isPending` and the transition's state committed "b pending" and then "b idle", and a separate button's "idle" committed after the panel its transition updated. A transition's completion now settles in the drain that renders its work (queueTransitionFall / armTransitionFalls / settleTransitionFalls). A hook whose block renders in that drain shows the falling edge in that render. A hook whose block has nothing queued publishes it once the drain's renders have decided their holds, and that render joins the same commit, ordered as the transition's first update. A render that suspends into a hold of the batch raises isPending again (cancelTransitionFall); a render still on the stack re-cues after its attempt, unless the attempt's unwind restored it. A synchronous transition's pending count, form status, and form resets settle in the same place, so a useOptimistic value reverts in that commit. The falling edge is transition work: an urgent update that takes over the transition's components, or a transition that updates nothing, leaves it for the task. A flushSync or act() drain that renders a cue together with its transition commits the cue first and leaves the edge a later task. transition-hooks: cycle/updater 3 -> 2 renders per cycle, urgent 4 -> 3. 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: Skipped drain swallows falling edge
- Modified publish() to not short-circuit when isPending was tentatively pre-set by fallTransitionHook: when wasTentative is true and pending is false, it now proceeds to scheduleRender even though isPending already matches, ensuring the falling edge renders when the drain skips the block.
Or push these changes by commenting:
@cursor push c3c58228da
Preview (c3c58228da)
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
@@ -44291,9 +44291,17 @@
if (!block.disposed) runTransition(fn, hook);
},
publish: (pending) => {
+ const wasTentative = hook.tentative;
hook.tentative = false;
- if (hook.isPending === pending || block.disposed) return;
- hook.isPending = pending;
+ if (block.disposed) return;
+ if (hook.isPending === pending) {
+ // A tentative falling edge must still schedule a render: the drain
+ // may have skipped the block (aborted root, retired subtree, hidden
+ // boundary), so the pre-set value was never rendered.
+ if (!wasTentative || pending) return;
+ } else {
+ hook.isPending = pending;
+ }
TRANSITION_LISTENER_PUBLISH_DEPTH++;
try {
if (typeof __OCTANE_PROFILE_ENABLED__ !== 'undefined' && __OCTANE_PROFILE_ENABLED__)You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit bede4dc. 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)
7 other measured values are unchanged. Public-import reachability bundles (bytes)
36 other measured values are unchanged. |
…iscards it A suspended root rolls back every render of its drain, including a block that already showed isPending's falling edge for another transition, and it skips that block's queued render. The hook then read idle while the screen kept the pending cue until an unrelated render. Such a completion now waits for the next task, which renders the edge with the work the root discarded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 0bb1653 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 05:59 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 0bb1653 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 06:01 PM |
The profile build records `transition-pending` when publish() schedules isPending's falling edge. A hook whose block already renders the transition's work shows the edge in that render without publishing, so its render reported no cause. Record it where the edge is applied, with the hook's profile-only source slot. Co-Authored-By: Claude Opus 5.5 <[email protected]>


Summary
useTransition'sisPendingnow falls in the render that commits the transition's own updates, as in React (#1864). That render used to be followed by a separate one.React's transition lane carries
setPending(false). Octane published the falling edge from a follow-up after the transition task's flush. That follow-up cost one extra render and one extra commit per transition, in the same task:mainPendingTabs)a pending, task, b pending, b idlea pending, task, b idlea pending, task, b idlePendingPanel)button pending, task, panel 1, button idlebutton pending, task, button idle, panel 1button pending, task, button idle, panel 1start(() => set(1)); set(2))button pending, panel 2, button idle, taskbutton pending, panel 2, task, button idlebutton pending, panel 2, task, button idlebutton pending, button idle, taskbutton pending, task, button idlebutton pending, task, button idleuseOptimistic+ update in one transition0/1, task, 1/1, 1/10/1, task, 1/10/1, task, 1/1button pendingbutton pendingbutton pendingI collected the React column with a React 19.2.7 jsdom probe in the session scratchpad, using the same fixtures and a marker task posted before the click.
How
queueTransitionFallreplacesafterTransitionFlush. Each transition's completion now settles in the drain that renders its work. For a synchronous callback that completion also includes the pending count, form status, and form resets. The task,flushSync,act(), and the discrete-event and View Transition flushes arm it.isPending === falsein that render (fallTransitionHook).settleTransitionFalls). Its effects take a sequence reserved when the drain armed. They therefore commit as the transition's first update, where React dispatchessetPending(false), not after the work it finishes (renderTransitionFall).isPendingis raised again (cancelTransitionFall).heldbenchmark control caught that.idlewhile its transition is held.flushSyncoract()renders a cue together with the transition it announces, the cue commits first. Its falling edge takes a later task, so the rising edge is never swallowed.Changes
packages/octane/src/runtime.ts: the completion queue (TRANSITION_FALLS,ARMED_TRANSITION_FALLS) and its driver entries (armFalls,settleFalls,cancelFall). ThedrainQueueloop settles at its end, andsplitTransitionCueroutes post-settle renders torenderTransitionFall. Thefalling/cueEpochfields are on the batch,tentativeon the hook slot, andraisedon the attempt.hasPendingWorkcounts waiting completions.afterTransitionFlushandTRANSITION_FOLLOWUPSare removed.packages/octane/tests/transition-flush-task.test.ts:main.isPendingmust not commitidle), and another transition's suspended root that discards the falling edge's render. That last one is from Bugbot's review and fails without the second commit.flushSynctest now also asserts the later falling edge.benchmarks/transition-hooks: controls forcycle,updater,held, andurgent; the work model; a README section.docs/differences-from-react.md§Scheduler, the website summary, and a changeset.Validation
vitest run --project octaneover the 76 test files that use transitions, Actions, optimistic values, or form status: 2,557 pass.--project octane-prodovertransition-flush-taskandtransitions: 87 pass.pnpm typecheck:files packages/octane/src/runtime.ts packages/octane/tests/transition-flush-task.test.ts packages/octane/tests/_fixtures/transition-flush-task.tsrx: clean.pnpm format:fileson every changed file, andpnpm sync: no generated drift.pnpm format:check,pnpm typecheck,pnpm test: not run repo-wide locally (load rule); CI covers them.mainbefore the runtime change. With the hold cancellation removed, the same-component and sibling-hold tests fail.benchmarks/transition-hooks(OCTANE_TRANSITION_TIMING=0), per 64 cycles,main(385d6aba9) → this PR:cycleupdaterheldurgentheld's +1 object per cycle is the journal snapshot of theisPendingbinding bag. The suspended attempt now renders the falling edge before the hold restores it, which is the work React does too. I attributed it per source line with an instrumented copy of the runner.Bundle bytes (
run-minimal.mjs,main→ this PR; reported only since #1907):root-statichooks-statesuspense-transitionbinding-radix-vitebinding-base-ui-esbuildAn app without transitions pays only the
drainQueueloop condition, thesplitCueposition argument, andhasPendingWork's check. The first cut was +2.1 kB for transition apps. I shrank it by:The second commit adds about 240 B for the discarded-root case below.
Perf review: fix/transition-falling-edge (
385d6aba9..HEAD)Scan:
node scripts/perf-review-scan.mjs→ 0 candidates.Hot paths touched:
drainQueuepass: one optionalTRANSITION_ROOT_DRIVER?.settleFalls()call, only once a transition has installed the driver. js-framework apps never install it.splitTransitionCue: one comparison per drained block, under the same driver.BlockImpl/ScopeImplfields. The new record fields (TransitionActionBatch,TransitionHookSlot,TransitionAttempt) each have a single literal allocation site with every key.packages/octane/src/runtime.ts(completion queue)renderTransitionFallNot checked: browser latency, because no Chromium Event Timing run was done.
Risk / follow-ups
flushSyncoract()drains a cue together with its transition, the falling edge moves to a later task. Before this PR it ran in a microtask after the flush. Tests that readisPendingright after aflushSync'd click are unchanged.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core transition scheduling, drain ordering, and Suspense hold interaction; behavior changes are broad but heavily tested and benchmark-pinned.
Overview
Aligns
useTransitionwith React by clearingisPendingin the same render/commit as the transition’s state updates (#1864), instead of a follow-up render after the transition task flush.The runtime replaces post-flush follow-ups with a completion queue (
queueTransitionFall,armTransitionFalls,settleTransitionFalls): the drain that renders transition work arms completions, hooks can show the falling edge in that render (fallTransitionHook), and blocks that only needidlecommit viarenderTransitionFallafter holds are decided. Suspense holds re-raise pending (cancelTransitionFall);flushSync/act()still commit the rising cue first and defer the falling edge to a later task.hasPendingWorkcounts waiting completions; sync and async Actions usequeueTransitionFallinstead ofafterTransitionFlush.Tests, transition-hooks benchmarks (fewer renders on
cycle/updater/urgent), and React-difference docs are updated for the new commit order.Reviewed by Cursor Bugbot for commit 0bb1653. Bugbot is set up for automated code reviews on this repo. Configure here.