Skip to content

fix(runtime): scope optimistic reverts to transition batches - #2218

Merged
trueadm merged 5 commits into
octanejs:mainfrom
dannyward630:fix/1348-optimistic-suspense-rollback
Oct 23, 2026
Merged

trueadm merged 5 commits into
octanejs:mainfrom
dannyward630:fix/1348-optimistic-suspense-rollback

Conversation

@dannyward630

@dannyward630 dannyward630 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Tie each useOptimistic update to the transition batch that created it.
  • Keep optimistic state visible through that batch's Suspense holds, then clear it when that batch finishes even if another root remains pending.

Why

  • The process-wide pending count can clear a delta before its own suspended transition commits, or keep a completed delta alive because unrelated work is still pending. This fixes #1348.

Changes

  • Retain the existing value queue and lazily track its transition owners in a parallel array.
  • Notify optimistic hooks when their own transition batches finish; detach those callbacks when a hook unmounts.
  • Preserve unowned-update reverts and other still-pending optimistic updates.
  • Add regression coverage for an owning Suspense hold, an unrelated suspended root, and an unowned update alongside a pending owned update.
  • Add an octane patch changeset.
  • Schedule the optimistic revert under the pending-state hook publication guard (scheduleHookPublication). A batch can finish inside a Suspense boundary's render when an urgent update supersedes a held transition, and the old global listener ran under that guard too. Regression: reverts without a cross-render warning when an urgent update supersedes its transition.
  • Revert batch-owned optimistic values in the transition render that folds their batch, and drop them at commit (React's revert lane). Urgent renders still show them. This fixes a double-applied value when a timeout fallback (setTransitionFallbackTimeout) lets held work commit: saved 1 / optimistic 2 until the boundary resolved, also present on main. Regression: reverts with the held work a timeout fallback lets commit (urgentFirst=false).
  • An urgent render that folds a ready batch whose timeout-fallback hold is still open also skips and drops that batch's values. Previously this rendered saved 1 / optimistic 12 instead of 11. Other urgent renders keep showing optimistic values, as React does. Regression: … (urgentFirst=true).

Validation

  • pnpm sync — passed.
  • node scripts/split-runtime.mjs check — 34 modules, 0 violations.
  • Scoped Prettier check and git diff --check — passed.
  • node scripts/check-changesets.js and node scripts/check-release-plan.mjs — passed.
  • Targeted tests: tests/actions.test.ts — 33/33 in development and production compilation; tests/conformance/async-actions.test.ts — 10/10 in development.
  • typecheck-files — 4 changed runtime TypeScript files passed.
  • Full pnpm format:check, pnpm typecheck, and pnpm test — not run locally; targeted checks above were used.
  • Follow-up commit d466f6f1dd (after merging main at f47ddbf2b2):
    • The new regression test fails on 4c60a254ac, logging Cannot update a component (`OptimisticSupersededTransition`) while rendering a different component (`SupersededValue`). It passes on main's runtime and with the fix.
    • tests/actions.test.ts: 34/34 in octane and octane-prod.
    • Nearby transition suites: transitions, transition-hook-pending, transition-action-order, transition-urgent-equality, transition-timeout, conformance/async-actions — 178/178 in octane.
    • Scoped Prettier check, split-runtime check (0 violations) and pnpm sync (no changes) pass.
    • Scoped typecheck:files reports no errors in the changed source or the added test code; the errors it does report are on pre-existing untyped fixtures and the submit helper.
    • The previous run's only red check, heavy integration, was a wall-clock bound in compiler-vite-options.test.ts (6.19 s against a 6 s limit). It is unrelated to this diff, and the push reruns it.
  • Follow-up commit 9f54d1c491 (Bugbot's timeout-reveal finding):
    • The new test fails with the render-time skip removed (optimistic 2, expected 1). It also fails with only the commit-time drop removed (12, expected 11).
    • tests/actions.test.ts and conformance/async-actions.test.ts: 90/90 in octane and octane-prod.
    • transitions, every transition-*, signals-action-lifecycle, fresh-root-scope-hold and effect-event-actions: 248/248 in octane. An earlier version that also skipped values in urgent renders failed transition-flush-task's "commits an optimistic value with the child's previous state", so urgent renders keep them.
    • Scoped Prettier check, split-runtime check, pnpm sync and source typecheck:files pass.
  • Follow-up commit c6533647e0 (Bugbot's urgent-fold finding):
    • urgentFirst=true fails without the hold clause (12, expected 11).
    • Actions and async-actions: 92/92 in octane and octane-prod.
    • Transition suites: 248/248 in octane.
    • Scoped checks pass.
  • perf-review (follow-up): the scan's only candidate is the existing unowned-revert microtask above. The guard adds one counter increment and decrement per optimistic revert, which runs once per finished batch per hook and is not a per-render path.
  • concise-code (follow-up): +10 runtime lines. The rejected alternative wraps publishTransitionBatchFinished in the guard, but the depth counter is private to engine.ts, so that needs exported increment and decrement helpers.

Perf review: issue #1348

Scan: node scripts/perf-review-scan.mjs → 1 candidate.

Hot paths touched: useOptimistic's render fold is unchanged; owner tracking runs on optimistic dispatch; queue compaction and callback publication run when a transition batch finishes.

# Severity Location Dimension Finding Required evidence Provided?
1 note packages/octane/src/runtime/actions.ts:771 scheduling Retains the existing one-microtask-per-burst revert for updates dispatched outside a transition. The callback compacts all unowned entries once and queues at most one urgent render. Marker-task count for a scheduling or commit-count claim No scheduling or latency claim is made.

No dedicated useOptimistic allocation benchmark is present, so no local performance claim is made. The batch callback set and owner array add bounded per-batch/per-hook state; the render-time value fold stays unchanged.

Concise-code

  • Source: +108 / −78 lines (runtime: +108 / −78).
  • New files: patch changeset; tests extend the existing actions fixture and suite.
  • New export: internal onTransitionBatchFinished, used by useOptimistic.
  • Alternatives: retaining the global count cannot distinguish unrelated pending work; queue records would allocate one wrapper per optimistic update and add reads to every render. The parallel owner array is allocated only when a hook first records a batch-owned update.
  • Bundle bytes: not measured locally; no size claim is made.

Risk / follow-ups

  • The targeted tests use jsdom; no real-browser run or full suite was run locally.
  • The PR is left as a draft for maintainer review under the repository's AI contribution policy.

Provenance

  • An agent produced this diff (agent-authored)

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


Note

Medium Risk
Touches transition batch lifecycle and render/commit folding for optimistic state—core React 19 actions behavior with several edge paths (Suspense, timeout fallback, urgent supersede), though changes are localized and heavily regression-tested.

Overview
Fixes useOptimistic lifetime so it follows the transition batch that created each update, not the global transition pending count (issue #1348).

Each queued optimistic value is tagged with its owning TransitionActionBatch. The hook subscribes via onTransitionBatchFinished and compacts only that batch’s entries when that batch’s work and holds finish, so unrelated pending transitions no longer clear or prolong optimistic UI incorrectly. Unowned addOptimistic calls still revert on a microtask burst.

On render, batch-owned values are skipped when a transition render folds their batch (or when a timeout fallback left a hold open on an urgent path), with queue cleanup at commit via TRANSITION_ROOT_DRIVER.fold and atCommit—matching React’s revert lane and avoiding double-counted optimistic state after partial commits. Revert refreshes use scheduleHookPublication instead of the removed global TRANSITION_LISTENERS on tickTransitionCount.

Adds regression tests for Suspense holds, an unrelated suspended root, transition-timeout fallback, and urgent supersede without cross-render warnings; includes an octane patch changeset.

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 23, 2026
@trueadm
trueadm marked this pull request as ready for review October 23, 2026 14:23
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🟡 js-framework: 1 timed operation(s) slower beyond ±3%
  • 🔴 bundle-size: 44 value(s) increased
  • 🔴 bundle-reachability: 30 value(s) increased

Compares f47ddbf2b, the merge commit's first parent with cc20ab408 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. 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

target operation base ms head ms head/base 95% CI
octane-tsrx replace 8.533 9.467 +15.0% +3.0% … +30.4% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 3.583 3.675 +3.0% −6.0% … +12.4% ⚪ within noise
octane-tsrx replace 8.533 9.467 +15.0% +3.0% … +30.4% 🟡 slower
octane-tsrx add 3.325 3.092 −3.8% −15.1% … +1.8% ⚪ within noise
octane-tsrx update 0.109 0.109 +2.0% −5.5% … +10.8% ⚪ within noise
octane-tsrx select 0.008 0.009 +6.3% +0.7% … +15.9% ⚪ within noise
octane-tsrx swap 0.028 0.028 −4.4% −13.2% … +2.3% ⚪ within noise
octane-tsrx remove 0.022 0.021 −1.3% −16.1% … +11.9% ⚪ within noise
octane-tsrx runlots 26.417 29.208 +4.9% −5.4% … +17.7% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 +1.7% −0.3% … +3.3% ⚪ within noise
octane-tsrx clear 61.508 63.133 +2.6% +0.2% … +8.4% ⚪ within noise
octane-jsx run 6.533 6.067 −3.9% −13.9% … +4.5% ⚪ within noise
octane-jsx replace 11.858 12.367 −3.5% −10.9% … +11.0% ⚪ within noise
octane-jsx add 5.383 5.183 +2.5% −8.2% … +8.6% ⚪ within noise
octane-jsx update 0.237 0.226 +1.6% −5.0% … +8.7% ⚪ within noise
octane-jsx select 0.149 0.158 +3.6% −7.5% … +8.8% ⚪ within noise
octane-jsx swap 0.220 0.239 +0.4% −3.7% … +16.3% ⚪ within noise
octane-jsx remove 0.175 0.170 +1.1% −4.8% … +17.1% ⚪ within noise
octane-jsx runlots 35.917 35.483 +0.1% −13.1% … +18.6% ⚪ within noise
octane-jsx select_lots 1.396 1.463 −2.0% −11.7% … +10.9% ⚪ within noise
octane-jsx clear 73.325 69.333 −5.6% −11.8% … +3.6% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_raw 693,709 693,773 +64 (+0.0%) 🔴
octane-tsrx bindings_js_gzip 229,312 229,318 +6 (+0.0%) 🔴
octane-tsrx bindings_js_brotli 195,303 195,330 +27 (+0.0%) 🔴
octane-tsrx bindings_app_brotli 98,949 99,011 +62 (+0.1%) 🔴
octane-tsrx bindings_fw_raw 332,717 332,781 +64 (+0.0%) 🔴
octane-tsrx bindings_fw_gzip 110,053 110,059 +6 (+0.0%) 🔴
octane-tsrx bindings_fw_brotli 96,354 96,319 −35 (−0.0%) 🟢
octane-tsrx shell_js_raw 305,179 305,240 +61 (+0.0%) 🔴
octane-tsrx shell_js_gzip 99,461 99,477 +16 (+0.0%) 🔴
octane-tsrx shell_js_brotli 86,551 86,558 +7 (+0.0%) 🔴
octane-tsrx shell_app_gzip 1,192 1,191 −1 (−0.1%) 🟢
octane-tsrx shell_app_brotli 1,035 1,058 +23 (+2.2%) 🔴
octane-tsrx shell_fw_raw 303,224 303,285 +61 (+0.0%) 🔴
octane-tsrx shell_fw_gzip 98,269 98,286 +17 (+0.0%) 🔴
octane-tsrx shell_fw_brotli 85,516 85,500 −16 (−0.0%) 🟢
octane-tsrx shell_client_js_raw 250,128 250,192 +64 (+0.0%) 🔴
octane-tsrx shell_client_js_gzip 81,264 81,276 +12 (+0.0%) 🔴
octane-tsrx shell_client_js_brotli 71,426 71,514 +88 (+0.1%) 🔴
octane-tsrx shell_client_app_gzip 1,191 1,194 +3 (+0.3%) 🔴
octane-tsrx shell_client_app_brotli 1,041 1,040 −1 (−0.1%) 🟢
octane-tsrx shell_client_fw_raw 248,165 248,229 +64 (+0.0%) 🔴
octane-tsrx shell_client_fw_gzip 80,073 80,082 +9 (+0.0%) 🔴
octane-tsrx shell_client_fw_brotli 70,385 70,474 +89 (+0.1%) 🔴
octane-tsrx wayfinder_js_raw 448,585 448,649 +64 (+0.0%) 🔴
octane-tsrx wayfinder_js_gzip 147,934 147,946 +12 (+0.0%) 🔴
octane-tsrx wayfinder_js_brotli 129,083 129,132 +49 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_raw 546,927 546,991 +64 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 172,070 172,079 +9 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 146,173 146,109 −64 (−0.0%) 🟢
octane-tsrx pagecraft_esbuild_js_raw 580,423 580,489 +66 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 187,779 187,782 +3 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 159,806 159,732 −74 (−0.0%) 🟢
octane-tsrx full_fw_raw 541,692 542,564 +872 (+0.2%) 🔴
octane-tsrx full_fw_gzip 169,363 169,670 +307 (+0.2%) 🔴
octane-tsrx full_fw_brotli 144,032 144,203 +171 (+0.1%) 🔴
octane-jsx shell_js_raw 335,916 335,980 +64 (+0.0%) 🔴
octane-jsx shell_js_gzip 109,532 109,550 +18 (+0.0%) 🔴
octane-jsx shell_js_brotli 95,157 95,029 −128 (−0.1%) 🟢
octane-jsx shell_app_gzip 763 768 +5 (+0.7%) 🔴
octane-jsx shell_app_brotli 655 658 +3 (+0.5%) 🔴
octane-jsx shell_fw_raw 334,823 334,887 +64 (+0.0%) 🔴
octane-jsx shell_fw_gzip 108,769 108,782 +13 (+0.0%) 🔴
octane-jsx shell_fw_brotli 94,502 94,371 −131 (−0.1%) 🟢
octane-jsx shell_client_js_raw 280,572 280,636 +64 (+0.0%) 🔴
octane-jsx shell_client_js_gzip 90,911 90,921 +10 (+0.0%) 🔴
octane-jsx shell_client_js_brotli 79,540 79,532 −8 (−0.0%) 🟢
octane-jsx shell_client_app_gzip 767 768 +1 (+0.1%) 🔴
octane-jsx shell_client_app_brotli 658 661 +3 (+0.5%) 🔴
octane-jsx shell_client_fw_raw 279,471 279,535 +64 (+0.0%) 🔴
octane-jsx shell_client_fw_gzip 90,144 90,153 +9 (+0.0%) 🔴
octane-jsx shell_client_fw_brotli 78,882 78,871 −11 (−0.0%) 🟢
octane-jsx full_fw_raw 541,692 542,564 +872 (+0.2%) 🔴
octane-jsx full_fw_gzip 169,363 169,670 +307 (+0.2%) 🔴
octane-jsx full_fw_brotli 144,032 144,203 +171 (+0.1%) 🔴

57 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
deferred-hydration raw 187,720 187,763 +43 (+0.0%) 🔴
deferred-hydration gzip 61,255 61,270 +15 (+0.0%) 🔴
deferred-hydration brotli 53,596 53,576 −20 (−0.0%) 🟢
hydrate-frame raw 349,001 349,044 +43 (+0.0%) 🔴
hydrate-frame gzip 112,112 112,113 +1 (+0.0%) 🔴
hydrate-frame brotli 97,406 97,393 −13 (−0.0%) 🟢
suspense-transition raw 115,747 115,811 +64 (+0.1%) 🔴
suspense-transition gzip 37,928 37,938 +10 (+0.0%) 🔴
suspense-transition brotli 33,777 33,751 −26 (−0.1%) 🟢
descriptor-children raw 159,216 159,280 +64 (+0.0%) 🔴
descriptor-children gzip 51,747 51,759 +12 (+0.0%) 🔴
descriptor-children brotli 46,036 46,058 +22 (+0.0%) 🔴
split-shell raw 399,930 399,994 +64 (+0.0%) 🔴
split-shell gzip 130,386 130,392 +6 (+0.0%) 🔴
split-shell brotli 113,536 113,523 −13 (−0.0%) 🟢
split-shell-runtime raw 323,227 323,291 +64 (+0.0%) 🔴
split-shell-runtime gzip 104,107 104,118 +11 (+0.0%) 🔴
split-shell-runtime brotli 89,863 89,866 +3 (+0.0%) 🔴
binding-base-ui-vite raw 169,870 169,936 +66 (+0.0%) 🔴
binding-base-ui-vite gzip 55,462 55,470 +8 (+0.0%) 🔴
binding-base-ui-vite brotli 49,265 49,300 +35 (+0.1%) 🔴
binding-base-ui-esbuild raw 198,196 198,264 +68 (+0.0%) 🔴
binding-base-ui-esbuild gzip 66,646 66,659 +13 (+0.0%) 🔴
binding-radix-vite raw 169,204 169,268 +64 (+0.0%) 🔴
binding-radix-vite gzip 55,082 55,093 +11 (+0.0%) 🔴
binding-radix-vite brotli 48,938 48,914 −24 (−0.0%) 🟢
binding-radix-esbuild raw 197,579 197,647 +68 (+0.0%) 🔴
binding-radix-esbuild gzip 66,330 66,323 −7 (−0.0%) 🟢
binding-radix-esbuild brotli 58,700 58,693 −7 (−0.0%) 🟢
binding-mantine-hooks-esbuild raw 78,561 78,565 +4 (+0.0%) 🔴
binding-mantine-hooks-esbuild brotli 25,105 25,185 +80 (+0.3%) 🔴
binding-apollo-client-vite raw 316,280 316,344 +64 (+0.0%) 🔴
binding-apollo-client-vite gzip 98,867 98,873 +6 (+0.0%) 🔴
binding-apollo-client-vite brotli 87,586 87,473 −113 (−0.1%) 🟢
binding-apollo-client-esbuild raw 352,117 352,185 +68 (+0.0%) 🔴
binding-apollo-client-esbuild gzip 114,223 114,239 +16 (+0.0%) 🔴
binding-apollo-client-esbuild brotli 100,794 100,731 −63 (−0.1%) 🟢
binding-usehooks-ts-esbuild raw 79,329 79,333 +4 (+0.0%) 🔴
binding-usehooks-ts-esbuild brotli 25,409 25,423 +14 (+0.1%) 🔴

84 other measured values are unchanged.

trueadm and others added 2 commits October 23, 2026 18:39
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]>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/octane/src/runtime/actions.ts Resolved
…n render

A transition render that folds a batch's state updates now skips that
batch's useOptimistic values and drops them at commit, as React reverts
an optimistic update in its transition's lane. Previously the values
stayed queued until the batch finished, so held work that a timeout
fallback (setTransitionFallbackTimeout) let commit showed the new state
with the optimistic delta applied twice until the boundary resolved.

Urgent renders still show every queued value, matching React's urgent
optimistic lane, and a dropped transition render discards the drop, so
a held batch keeps its values. The finish listener still clears values
for batches whose owner never re-renders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 9f54d1c. Configure here.

Comment thread packages/octane/src/runtime/actions.ts Resolved
Between a timeout fallback releasing held work and its retry task, an
urgent render folds the ready batch (foldHookQueue) while the batch's
hold stays open, so it does not finish in that drain. useOptimistic kept
the batch's values in urgent renders and painted the delta twice
(saved 1, optimistic 12 instead of 11).

An urgent render now skips and drops a batch's values when it folds a
ready batch that still has an open hold, which can only be a timeout
fallback. Other urgent renders keep showing them, as React renders
optimistic values urgently; transition-flush-task's ancestor-cue parity
test pins that, and a no-hold batch folded urgently finishes in the same
drain.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit af767d7 into octanejs:main Oct 23, 2026
32 checks passed
trueadm added a commit that referenced this pull request Oct 23, 2026
main now has #2218 (squashed) and #2221. The conflicts were in #2218's
own files, actions.ts and actions.test.ts, which this branch carried at
#2218's earlier head; they take main's version.

#2218's later commits revert a transition's optimistic values once a
timeout fallback lets its batch commit around the fallback, so the
behind-the-fallback case now pins only isPending, and leaves the
optimistic value to that rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
trueadm added a commit that referenced this pull request Oct 23, 2026
* 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]>
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.

useOptimistic clears too early or too late when saves overlap Suspense

2 participants