Skip to content

fix(octane): keep a committed View Transition running through urgent updates - #2117

Merged
trueadm merged 2 commits into
mainfrom
fix/vt-cached-layout-update
Oct 16, 2026
Merged

trueadm merged 2 commits into
mainfrom
fix/vt-cached-layout-update

Conversation

@o-alexandrov

@o-alexandrov o-alexandrov commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An urgent update skipped a View Transition even after ready resolved and the animation was running. React only skips a transition that is still preparing. Octane now does the same: an urgent commit after ready changes the live DOM under the running animation.

Why

We found this in a production app. Opening a foreground view (art details) animated the first time and was skipped every time the same item was reopened. On reopen the image is cached, so a layout effect calls setState synchronously, and a measuring hook's ResizeObserver schedules more urgent work while the animation runs. routeFlush sees an urgent update against an owner with an active handle and calls vtInterruptOwners, which calls skipTransition() on the running animation. flushSync takes the same path through driver.interrupt.

react-dom 19.3 skips in one place: flushPendingEffects calls pendingViewTransition.skipTransition(). pendingViewTransition is cleared in flushSpawnedWork, which runs from transition.ready.then. After that, urgent work commits normally and the live ::view-transition-new capture shows it. flushPendingEffects then also runs the animating commit's passive effects before the urgent render.

Standalone Chromium repro: startTransition mounts a <ViewTransition enter="auto">, then flushSync updates a sibling 0, 30 or 120 ms later.

flushSync after React 19.3 Octane main This PR
0 ms (preparing) finished 436 ms skipped at 1 ms skipped at 1 ms
30 ms (animating) finished 406 ms skipped at 28 ms finished 427 ms
120 ms (animating) finished 408 ms skipped at 119 ms finished 406 ms

The 0 ms row is the case where React and Octane both still skip, as intended.

Changes

  • runtime.ts: VTSession records committed, set when the handle's ready resolves, and a release callback for the commit's held passive effects. The new vtInterruptPreparing(owners) interrupts a pending capture and skips only handles whose session hasn't committed. An external handle has no receipt, so it still counts as preparing. For committed sessions it releases the held passives and drains them before the urgent work, as React's flushPendingEffects does.
  • Callers switched to vtInterruptPreparing: routeFlush's active-handle branch, wrapResume's urgent-sibling branch, and driver.interrupt (flushSync, a direct root render, and a public unmount). Unchanged callers of vtInterrupt/vtInterruptOwners: routeFlush when passives don't settle or a capture is still pending, wrapResume when passives don't settle, the staged-layout interruption, and scope release. Until ready resolves, those paths still skip, matching React.
  • Tests that pinned the old rule now assert React's:
    • view-transition-scoped-effects.test.ts: an urgent update after both scope captures completed skips neither animation. A binding commit observes skipped: false for the committed scope.
    • browser/view-transition-scopes: an urgent update to a committed sibling scope keeps both scopes animating, with no cleanups until they finish.
    • browser/view-transition-parity: with the animation paused, flushSync commits under it without cleanup. The animation finishes once resumed.
  • Changeset: octane patch.

Validation

  • prettier --check on the changed files.
  • octane-tsc -p packages/octane/tsconfig.json: clean.
  • Related unit suites (view-transition*, conformance/view-transition, transition*, flush-sync*, behavior-root, stable-event-authority, native-resume-staged-publication, style-transaction-rollback, signals-*, event-signal-owner, and hydration/deferred-*) in octane and octane-prod: 70 files, 1953/1955 pass. The 2 failures were behavior-root textarea-retirement tests under load (one took 5.3 s). Run alone, that file passes 706/706, and the same tests pass on origin/main too. Before the test updates, the two scoped-effects tests failed in both projects.
  • Browser suites view-transition-parity, view-transition-scopes, activity-view-transition and view-transition-streaming (dev and prod): 89/89 pass. Before the test updates, the scopes test failed on its active assertion and the parity test timed out on the paused animation.
  • Downstream app: the patched dist in the app's dev server, with the app-side workaround removed, at 400px in headless Chromium. Three artworks, each opened three times: 9/9 opens animated (394–578 ms). On 0.13.8 under the same setup, 3 of 9 opens were skipped by vtInterruptOwners at 67–116 ms.
  • Full pnpm test: not run.
  • No new regression test for the cached-image case. The parity browser test now pins the general rule (urgent work during a running animation), and that rule is the fix.

Risk / follow-ups

  • Urgent work during an animation now shows up live inside ::view-transition-new instead of cancelling the animation. That matches React. Code that relied on flushSync to stop an animation should call skipTransition() on the handle explicitly.
  • Element-scoped sessions get the same rule, so an urgent update to one committed scope no longer skips its siblings or itself.
  • vtInterruptOwners is still used where Octane has to abandon a capture. I didn't change those paths.

Provenance

  • An agent produced this diff (agent-authored)

Note

Medium Risk
Changes when flushSync and other urgent commits interact with in-flight view transitions; behavior now matches React but may break code that relied on urgent updates to cancel animations.

Overview
Urgent updates (flushSync, discrete events, layout-effect setState) no longer cancel a View Transition after its update has committed and the native animation is running. Octane now mirrors React 19.3: only transitions still preparing (before handle.ready) are interrupted via skipTransition(); committed sessions are left animating while the urgent commit updates the live DOM underneath.

VTSession gains a committed flag (set when ready resolves) and an optional release hook for held passive effects. vtInterruptPreparing replaces broad skip logic on flushSync, routeFlush’s active-handle path, and wrapResume’s urgent-sibling branch—committed handles get passive release + drain instead of skipTransition(). Full vtInterrupt remains for unsettled passives and abandoned captures.

Browser and unit tests are updated to expect animations and scoped siblings to stay active through urgent work, with DOM/cleanup assertions aligned to React.

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

…updates

React skips only a transition still preparing (flushPendingEffects). Once the update callback committed, urgent work (flushSync, an event setState, a layout-effect setState) changes the live DOM under the running animation instead of skipping it.
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 16, 2026
@github-actions
github-actions Bot marked this pull request as draft October 16, 2026 17:19
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 416a1a5 Commit Preview URL

Branch Preview URL
Oct 16 2026, 06:00 PM

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 18 value(s) increased

Compares f79cfa922, the merge commit's first parent with 9ea20b822 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

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.950 2.875 −1.6% −3.7% … +3.5% ⚪ within noise
octane-tsrx replace 7.242 6.717 −1.5% −3.6% … +1.3% ⚪ within noise
octane-tsrx add 2.525 2.533 ±0.0% −3.8% … +4.1% ⚪ within noise
octane-tsrx update 0.134 0.131 +0.2% −2.9% … +1.5% ⚪ within noise
octane-tsrx select 0.005 0.005 −0.0% −0.8% … +1.4% ⚪ within noise
octane-tsrx swap 0.016 0.016 ±0.0% −1.1% … +1.6% ⚪ within noise
octane-tsrx remove 0.012 0.012 +0.3% −1.9% … +2.5% ⚪ within noise
octane-tsrx runlots 23.433 23.458 −1.7% −3.1% … +1.5% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −0.5% −0.6% … +0.6% ⚪ within noise
octane-tsrx clear 41.375 42.192 +1.6% −0.2% … +2.5% ⚪ within noise
octane-jsx run 3.100 3.083 ±0.0% −0.0% … +3.0% ⚪ within noise
octane-jsx replace 6.142 6.400 ±0.0% −3.2% … +3.7% ⚪ within noise
octane-jsx add 3.200 3.317 ±0.0% −3.1% … +3.2% ⚪ within noise
octane-jsx update 0.268 0.275 +1.2% −0.9% … +4.2% ⚪ within noise
octane-jsx select 0.133 0.134 +0.8% −5.1% … +4.4% ⚪ within noise
octane-jsx swap 0.204 0.205 +1.6% −3.9% … +6.2% ⚪ within noise
octane-jsx remove 0.200 0.208 +2.0% −4.7% … +6.7% ⚪ within noise
octane-jsx runlots 34.883 34.258 −1.7% −5.2% … +0.6% ⚪ within noise
octane-jsx select_lots 2.274 2.175 +0.7% −8.2% … +10.3% ⚪ within noise
octane-jsx clear 64.875 65.167 +4.6% −4.9% … +8.9% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx full_fw_raw 572,096 572,450 +354 (+0.1%) 🔴
octane-tsrx full_fw_gzip 173,057 173,145 +88 (+0.1%) 🔴
octane-tsrx full_fw_brotli 145,708 145,835 +127 (+0.1%) 🔴
octane-jsx shell_js_raw 390,603 390,963 +360 (+0.1%) 🔴
octane-jsx shell_js_gzip 122,675 122,761 +86 (+0.1%) 🔴
octane-jsx shell_js_brotli 104,737 104,747 +10 (+0.0%) 🔴
octane-jsx shell_app_gzip 768 764 −4 (−0.5%) 🟢
octane-jsx shell_app_brotli 673 656 −17 (−2.5%) 🟢
octane-jsx shell_fw_raw 389,510 389,870 +360 (+0.1%) 🔴
octane-jsx shell_fw_gzip 121,907 121,997 +90 (+0.1%) 🔴
octane-jsx shell_fw_brotli 104,064 104,091 +27 (+0.0%) 🔴
octane-jsx shell_client_js_raw 324,969 325,329 +360 (+0.1%) 🔴
octane-jsx shell_client_js_gzip 101,543 101,634 +91 (+0.1%) 🔴
octane-jsx shell_client_js_brotli 87,518 87,610 +92 (+0.1%) 🔴
octane-jsx shell_client_app_gzip 773 764 −9 (−1.2%) 🟢
octane-jsx shell_client_app_brotli 669 657 −12 (−1.8%) 🟢
octane-jsx shell_client_fw_raw 323,868 324,228 +360 (+0.1%) 🔴
octane-jsx shell_client_fw_gzip 100,770 100,870 +100 (+0.1%) 🔴
octane-jsx shell_client_fw_brotli 86,849 86,953 +104 (+0.1%) 🔴
octane-jsx full_fw_raw 572,096 572,450 +354 (+0.1%) 🔴
octane-jsx full_fw_gzip 173,057 173,145 +88 (+0.1%) 🔴
octane-jsx full_fw_brotli 145,708 145,835 +127 (+0.1%) 🔴

71 other measured values are unchanged.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 416a1a5 Commit Preview URL

Branch Preview URL
Oct 16 2026, 05:58 PM

@trueadm
trueadm marked this pull request as ready for review October 16, 2026 17:41
An urgent update against a committed View Transition now runs that commit's held passive effects first, as React's flushPendingEffects does. wrapResume's urgent-sibling branch uses the same committed-only skip. 'committed' is set when ready resolves, which is where React clears pendingViewTransition.
@trueadm
trueadm merged commit c144725 into main Oct 16, 2026
34 checks passed
@trueadm
trueadm deleted the fix/vt-cached-layout-update branch October 16, 2026 18:26
@github-actions github-actions Bot mentioned this pull request Oct 16, 2026
domgan-oai added a commit to openai-oss-forks/octane that referenced this pull request Oct 16, 2026
Port the behavior from octanejs#2117 to the split next runtime, including passive-effect release and partial-capture handling.
trueadm pushed a commit that referenced this pull request Oct 16, 2026
#2119)

* docs(octane): describe urgent updates during a running View Transition

Pin the held-passive ordering from #2117 with a parity browser test: an urgent update runs the animating commit's passive effects before its own.

* docs(octane): scope the urgent-skip sentences to the preparing phase

* docs(octane): scope the running-animation rule to fully started batches

A multi-scope batch keeps one capture until every scope is ready, and removing the last element-scoped boundary on a host still skips that host's animation.
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.

2 participants