Repository navigation
feat(octane): commit unrelated transitions independently - #2165
Conversation
React 19.3 renders each transition lane on its own, so a suspended transition no longer holds back an unrelated one. Octane held every pending transition until all of their data arrived: - The reveal barrier was global across held boundaries. It now groups boundaries that hold a common batch (stagedRevealGroup), so one transition's boundaries still reveal together while unrelated groups commit on their own. - useOptimistic reverted only when the global pending count reached 0. Each value now records its batch and reverts when that batch finishes. - A boundary holding several transitions woke only on its latest thenable. A held boundary now retries on any thenable it suspended on. Refs #2053. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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)
54 other measured values are unchanged. Public-import reachability bundles (bytes)
85 other measured values are unchanged. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 10d0168 | Commit Preview URL Branch Preview URL |
Oct 20 2026, 04:46 PM |
…dline Two review findings on parallel transitions: - stagedRevealGroup returned every ready group as one list, so a visible member's retry dropped an unrelated fallback-hidden member from STAGED_REVEALS without revealing it. It now returns one group, and flushStagedRevealsIfReady flushes each in turn. - A superseded thenable settling on a held boundary ran the resume path, which cleared the boundary's fallback timeout and pendingThenable. It now only retries the boundary's held batches, so the fresher thenable keeps its resume and its deadline. 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-mcp | 174e70f | Commit Preview URL Branch Preview URL |
Oct 20 2026, 05:13 PM |
… their thenable Two more review findings on parallel transitions: - flushStagedRevealsIfReady stopped at the first group whose reveal a view transition deferred, so later ready groups waited behind it. It now flushes each ready group once per call, and a deferred run commits only the members still staged, so a repeated flush is a no-op. - After a fallback timeout a hold no longer suspends, so retrying it on a superseded settle finished every batch the boundary held: a still waiting transition dropped isPending behind the fallback. Only a held boundary still on screen retries on a superseded settle now. 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 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Unready groups stay excluded from flush
- Moved the seen.add loop inside the readiness check so only ready (returned) groups are persisted in seen, allowing incomplete groups to be rediscovered on later iterations when a sibling flush makes them ready.
- ✅ Fixed: Empty reveal still commits effects
- Added an early return when the filtered batch is empty, preventing the vacuous-truth [].every(...) from setting deferEffects true and firing a spurious commitEffects() call.
Or push these changes by commenting:
@cursor push 2a4566a243
Preview (2a4566a243)
diff --git a/packages/octane/src/runtime/suspense.ts b/packages/octane/src/runtime/suspense.ts
--- a/packages/octane/src/runtime/suspense.ts
+++ b/packages/octane/src/runtime/suspense.ts
@@ -2928,6 +2928,7 @@
// A deferred run commits only the members still staged: another flush may
// have revealed them first.
const batch = group.filter((state) => STAGED_REVEALS.has(state));
+ if (batch.length === 0) return;
for (const state of batch) STAGED_REVEALS.delete(state);
// Only fallback-hidden members have completed rollback-safe render
// captures. A pre-timeout visible hold remains within Octane's documented
diff --git a/packages/octane/src/runtime/transitions.ts b/packages/octane/src/runtime/transitions.ts
--- a/packages/octane/src/runtime/transitions.ts
+++ b/packages/octane/src/runtime/transitions.ts
@@ -478,8 +478,10 @@
if (shares) group.push(other);
}
}
- for (const member of group) seen.add(member);
- if (group.every((member) => STAGED_REVEALS.has(member))) return group;
+ if (group.every((member) => STAGED_REVEALS.has(member))) {
+ for (const member of group) seen.add(member);
+ return group;
+ }
}
return null;
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 7fafcb2. Configure here.
|
Bugbot Autofix prepared fixes for both issues found in the latest run.
Or push these changes by commenting: Preview (8458a4cec5)diff --git a/packages/octane/src/runtime/suspense.ts b/packages/octane/src/runtime/suspense.ts
--- a/packages/octane/src/runtime/suspense.ts
+++ b/packages/octane/src/runtime/suspense.ts
@@ -2889,8 +2889,12 @@
for (const state of STAGED_REVEALS) {
if (!HELD_TRANSITIONS.has(state)) STAGED_REVEALS.delete(state);
}
- const group = STAGED_REVEALS.size === 0 ? null : stagedRevealGroup();
- if (group !== null) flushStagedReveals(group);
+ // Process one group at a time: each flush removes its members from
+ // STAGED_REVEALS, so independent groups never share a single batch.
+ let group: TrySlot[] | null;
+ while ((group = STAGED_REVEALS.size === 0 ? null : stagedRevealGroup()) !== null) {
+ flushStagedReveals(group);
+ }
}
function compareStagedRevealDomOrder(a: TrySlot, b: TrySlot): number {
@@ -2979,16 +2983,18 @@
// A fresher suspend supersedes this one, unless the boundary holds
// transitions: each holds its own batches (Transition holds), so any
// thenable they suspended on may let one of them commit.
- if (state.pendingThenable !== thenable && !HELD_TRANSITIONS.has(state)) return;
+ const isCurrent = state.pendingThenable === thenable;
+ if (!isCurrent && !HELD_TRANSITIONS.has(state)) return;
if (typeof __OCTANE_PROFILE_ENABLED__ !== 'undefined' && __OCTANE_PROFILE_ENABLED__)
__profileCount(ProfileCounter.BOUNDARY_RETRY);
- state.pendingThenable = null;
- // Cancel any pending transition-fallback timeout — the promise resolved
- // before the timeout would have swapped to @pending, so the prior DOM
- // stays put and the just-resolved render commits over it directly.
- if (state.transitionTimeoutId !== null) {
- clearTimeout(state.transitionTimeoutId);
- state.transitionTimeoutId = null;
+ // Only clear tracking state when the current thenable resolves. A stale
+ // settle on a held boundary must not disarm the fresher thenable's timeout.
+ if (isCurrent) {
+ state.pendingThenable = null;
+ if (state.transitionTimeoutId !== null) {
+ clearTimeout(state.transitionTimeoutId);
+ state.transitionTimeoutId = null;
+ }
}
const persistent = state.tryBlock;
if (persistent !== null && !persistent.disposed) {
diff --git a/packages/octane/src/runtime/transitions.ts b/packages/octane/src/runtime/transitions.ts
--- a/packages/octane/src/runtime/transitions.ts
+++ b/packages/octane/src/runtime/transitions.ts
@@ -458,7 +458,6 @@
* parallel transitions. Runs when a boundary stages, on a handful of boundaries.
*/
export function stagedRevealGroup(): TrySlot[] | null {
- let ready: TrySlot[] | null = null;
const seen = new Set<TrySlot>();
for (const start of STAGED_REVEALS) {
if (seen.has(start)) continue;
@@ -480,9 +479,9 @@
}
}
for (const member of group) seen.add(member);
- if (group.every((member) => STAGED_REVEALS.has(member))) (ready ??= []).push(...group);
+ if (group.every((member) => STAGED_REVEALS.has(member))) return group;
}
- return ready;
+ return null;
}
// ─────────────────────────────────────────────────────────────────────────────You can send follow-ups to the cloud agent here. |
…eals Two more review findings on the reveal-group loop: - stagedRevealGroup added the members of a group still waiting to the caller's set, so a group that flushing another made ready was skipped for the rest of the loop. Only flushed groups are skipped now; a waiting group is scanned again on the next pass. - A deferred reveal whose members another flush already revealed still committed effects, since every() is true for an empty list. It now returns without committing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(runtime): scope optimistic cleanup to transition batches * fix(runtime): keep optimistic reverts out of cross-render diagnosis A transition batch can finish while a Suspense boundary renders: an urgent update that supersedes a held transition releases the hold inside the boundary's render (releaseHeldTransition -> releaseTransitionHookHolder -> finishTransitionHookBatch). The batch-scoped useOptimistic revert then scheduled its block while another component was on the stack, so dev logged "Cannot update a component while rendering a different component" and the block was flagged as a cross-render update. The global listener this replaced ran under the publish-depth guard; schedule the revert under it again via scheduleHookPublication. Also update the TRANSITION_PENDING_COUNT comment: optimistic lifetimes no longer subscribe to it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(octane): commit unrelated transitions independently Re-lands #2165 on main. It merged into `next` on 2026-10-20, after #2103 had already integrated `next` into `main`, and `next` was then deleted, so the change never reached `main`. This is the #2165 squash commit (2af686e) without its useOptimistic fix: #2218 scopes optimistic reverts to their transition batch, so this change builds on it rather than adding a second mechanism. React 19.3 renders each transition lane on its own, so a suspended transition no longer holds back an unrelated one: - The reveal barrier groups held boundaries that hold a common batch (stagedRevealGroup), so one transition's boundaries still reveal together while unrelated groups commit on their own, each once per flush. - A held boundary still on screen retries its batches when any thenable it suspended on settles, keeping the fresher thenable's resume and fallback timeout. Refs #2053. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): give boundaries without a batch hold their own reveal group stagedRevealGroup put every held boundary without a batch hold into every group. That one rule covered three different cases: a transition that folded no hook work (`root.render` in startTransition), a holder released during its retry, and members of a view-transition-deferred reveal. So unrelated groups were pulled together: a hook transition waited behind an unrelated root.render transition, and a deferred group could be absorbed into another flush. Boundaries without a batch hold now form one group of their own, the barrier before parallel transitions, and never join a batch's group. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): render a deferred value's final attempt while a root holds its first render (#2223) * fix(octane): render a deferred value's final attempt while a root holds its first render When a root with no Suspense boundary suspends on its first render, a useDeferredValue mounted with an initialValue spawned its swap, but the rollback disposed the slot and the swap was dropped. The final value never rendered until the preview fully loaded. The swap now renders the root again as a deferred pass in its host task. Its suspension keeps the original attempt's wakeable live, so whichever attempt is ready first commits, as in React 19.3 (react/react#35392). Ports the two React 19.3.0 ReactDeferredValue-test.js sibling cases into parallel-transitions.test.ts, and :407 and :526 into deferred-value.test.ts, asserting committed DOM. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): retry a held root's deferred attempt once per swap task Each disposed useDeferredValue slot from a rolled-back root render called owner.retry(true) on its own. With two such hooks, the second deferred attempt rolled back the first and unioned only its wakeable, so the original attempt's data no longer retried the root and the initial values never committed. Collect held roots and retry each once. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * test(octane): reveal a parked hydration boundary while an unrelated transition holds The sibling case from #2193 expected Gate's ready reveal to wait for Later's unrelated transition, the global barrier from before parallel transitions. Gate's root.render transition and Later's setLater transition are separate, so Gate now reveals once its own data lands while Later keeps holding; the primary, listener and event assertions run at that point. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: dannyward630 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>


Summary
Parallel transitions, matching React 19.3 (react/react#35392, enabled in OSS by #37290). Unrelated transitions now commit independently: a transition that suspends holds only its own work. Before this PR, Octane held every pending transition until all of their data had arrived, then committed them together.
Refs #2053. This is the parallel-transitions half; Trusted Types landed in #2162.
Why
The tests ported from React showed three separate causes. A throwaway probe confirmed each one:
runtime/suspense.ts): a held boundary whose data settled waited until every boundary inHELD_TRANSITIONSwas staged, across all transitions.useOptimisticrevert (runtime/actions.ts): it cleared only when the globalTRANSITION_PENDING_COUNTreached 0, so B's optimistic value waited for unrelated A.pendingThenable. Re-rendering B's drain re-attached A's thenable, and B's settle then hit the "superseded by a fresher suspend" guard and was dropped.Changes
transitions.ts:stagedRevealGroup()groups held boundaries that hold a common root batch, transitively. A group reveals once all its members are staged. A held boundary with no batch hold joins every group, which keeps the old barrier when no hook work was folded.suspense.ts:flushStagedRevealsIfReadyandflushStagedReveals(group)flush only the ready group. Other staged boundaries stay staged.attachResume's retry still drops a superseded thenable, except for a boundary inHELD_TRANSITIONS.actions.ts,types.tsandtransitions.ts:transitionActionBatchForUpdate);batch.optimistic, initializednullin the single batch literal);finishTransitionHookBatchruns those reverts;docs/differences-from-react.mdScheduler section. It also notes that Octane has no 10-lane reuse, so it never entangles transitions that way.SUSPENSE_DIVERGENCE.md.octaneminor.Validation
pnpm format:files:checkpnpm typecheck:fileson every changed source, test, and fixture filepnpm test: not run locally (machine load rule). Left to CI.New
tests/conformance/parallel-transitions.test.ts, 11 cases. Seven are ported fromReactTransition-test.js:isPending;useOptimisticrevert;Four more are regressions for the Bugbot findings:
The independence cases failed before this PR, and each Bugbot case failed on the commit before its fix. All 11 now pass in both
octaneandoctane-prod.Neighbour behavior:
conformance/entangled-commit.test.ts, where one transition fanning out to two boundaries still reveals them together, passes.64 related test files (transitions, suspense, optimistic, actions, entanglement, view transitions) in
octaneandoctane-prod: 126 files, 2,706 tests passed.stagedRevealGroupreturns one group, andflushStagedRevealsIfReadyflushes each in turn.runcommits only members still staged.perf-review: scan of the diff againstorigin/next→ 1 candidate, dismissed.actions.ts:638scheduleRenderis the existing optimistic revert moved into a sharedrevert(). It runs once per finished batch per optimistic slot.stagedRevealGroupruns when a boundary stages, on thenable settle, over a handful of boundaries.attachResumechange adds aHELD_TRANSITIONS.hascheck only on the superseded branch.finishTransitionHookBatchgains one null check per batch.optimisticin its single literal.concise-code:src.dropTransitionRenderalready holds only the drained origin's batches and re-renders the others.entangled-commit.Risk / follow-ups
ReactDeferredValuesibling-suspend interleaving tests (the "prewarm" log changes).Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
High Risk
Changes core transition/Suspense commit ordering, optimistic revert timing, and held-boundary resume behavior—areas that affect concurrent UI updates and perceived loading state.
Overview
Parallel transitions (React 19.3): unrelated
startTransitionwork no longer waits on a global Suspense reveal barrier. Each transition commits when its own async data is ready—separate or shared@tryboundaries—whileisPendinganduseOptimisticsettle per transition, not when every held boundary finishes.Suspense coordination replaces the old “all of
HELD_TRANSITIONSmust stage together” rule withstagedRevealGroup: boundaries that share the same root transition batch reveal as one group; unrelated groups flush independently viaflushStagedReveals(group). A superseded thenable on an on-screen held boundary canretrythat boundary’s batches so another transition’s settle is not dropped.useOptimistictags each queued value with its dispatch batch and registersrevertBatchonTransitionActionBatch.optimistic, cleared infinishTransitionHookBatchinstead of only when global transition pending hits zero.Docs/changeset note Octane tracks transitions separately (no React 10-lane reuse). New
parallel-transitionsconformance tests cover independence, same-queue entanglement, fallback timeout, and view-transition deferral.Reviewed by Cursor Bugbot for commit 174e70f. Bugbot is set up for automated code reviews on this repo. Configure here.