Repository navigation
fix(octane): keep updating an only text child after page translation - #1915
Conversation
Chrome's page translator replaces a Text node with nested <font> wrappers
and detaches the original. React's setTextContent then rewrites the host's
content, but Octane kept writing the detached node, so the stale
translation stayed on screen. Switching that child to an element or to
nothing also left the translation behind.
Renderable only-child holes and `{x as string}` bindings whose host is
already in the binding bag pass the host to setText, which checks the
Text's parent once and restores the Text into the host when a translator
took it out. A seeded native host with no other stored binding keeps the
host in place of the Text, so the bag gains no field; setOnlyText writes
the host's first child and resets the host when that is not a Text.
childTextHole and the spread-host signal child clear a translated host on
a mode switch.
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)
1 other measured values are unchanged. Public-import reachability bundles (bytes)
45 other measured values are unchanged. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 54f2356 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 08:18 PM |
A text binding that keeps only its host now calls `setText(null, value, host)` instead of a new `setOnlyText` export from `octane/internal/client`. The new import broke builds that only provide the public `octane` entry (the Rsbuild React-plugin integration and the evals client runtime), and the wrapper added one production call per update, which the js-framework work gate counts. setText stays the single text writer, so its journaling, view-transition marking and call counts are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The React parity lint matches every mountDifferential call's fixture argument to a top-level preload. The shared steps helper took the fixture as a parameter, which the lint cannot resolve; each case now mounts its preloaded fixture constant and hands the pair to the helper. 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: Presentation writes miss host-only text
- The presentationWrite setText handler now forwards args[2] (the host) to the deferred writer and uses it as the Map tracking target when args[0] is null, preventing nodeValue from being assigned on null.
Or push these changes by commenting:
@cursor push 97f022d270
Preview (97f022d270)
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
@@ -24469,7 +24469,8 @@
if (kind === 'bindSignalText') return preparePresentationSignalBinding(args, frame, true) as T;
if (kind === 'setText') {
const text = coerceText(args[1]);
- preparePresentationOperation(frame, args[0], 'text', () => writer(args[0], text));
+ const host = args[2];
+ preparePresentationOperation(frame, args[0] ?? host, 'text', () => writer(args[0], text, host));
return undefined as T;
}
if (kind === 'bindSignalAttribute') return preparePresentationSignalBinding(args, frame) as T;You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 063ee74. Configure here.
presentationWrite's setText branch keyed the prepared write by its first argument and dropped the rest, so a host-only text binding's `setText(null, value, host)` would have prepared a write against `null`. Key it by the host when no Text is passed, and pass the host on to the deferred write so the page-translation repair applies there too. 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 | 54f2356 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 08:16 PM |
…udit (#1943) #1915 renamed setText's text node to `target` and wrapped its journal call, so contracts.mjs's exact-string instrumentation found no match and the root-transactions audit threw before measuring anything. Match the call with a pattern that accepts any spelling of the staged-view read, so the pending ternary form in #1942 keeps matching too. Co-authored-by: Claude Opus 5.5 <[email protected]>


Summary
When the browser translates the page, an element's only text child stops updating. This
fixes that to match React.
Chrome's page translator replaces each Text node with nested
<font>wrappers holding thetranslation, then detaches the original node. On the next update, React's
setTextContentsees the host no longer holds a single Text node and writestextContent, so the page shows the new message. Octane kept writingnodeValueinto thedetached node, so
<span>{message}</span>and<span>{message as string}</span>went onshowing the stale translation. Switching that child to an element left the
<font>besidethe new element. Switching it to nothing left the translation in place.
Changes
childTextHoleUpdate, the keyed-row inlineguard, and
childTextHole. They pass their host tosetText(node, value, host). OneparentNode === hostread confirms the cached Text is still what the host shows.resetOnlyChildHostclears the host and re-appends the binding's ownText, so every cache holding that node stays valid. Under a root render transaction,
the host's previous children are journaled first.
''and to an element clear a translated host instead of callingremove()on a detached node.{x as string}where another binding already keeps the host in the bag (for examplea
classbinding). The compiler passes that shared host tosetText, so no new field isadded.
{x as string}on a seeded native host with no other stored binding. The bag keepsthe host in place of the Text, so the field count is unchanged. The update calls
setText(null, value, host): with no node,setTextwrites the host's first child, andresets the host when that child is not a Text.
<template>hosts, whose Text may follow children they do not own,keep the Text and store a host field.
bindSignalChild's primitive token path). The holechecks that the host's first child is a Text before reusing it.
too, so that path is already at parity.
setTextstays the only text writer, so its view-transition dirty marking, journaling, andproduction call counts are unchanged. Compiled output imports nothing new.
Validation
pnpm format:check: left to CI.pnpm format:files:checkpassed on every changedfile.
pnpm typecheck: left to CI.pnpm typecheck:filespassed onruntime.ts, thetests, and both fixtures.
pnpm test: left to CI.differential/translated-text.test.tsruns the same.tsrxthrough Octane and@tsrx/react(10 cases).hydration/translated-text-hydrate.test.tsadds 5server-render-then-hydrate cases.
octaneandoctane-prodprojects.text → element: the old token path removed the
<font>by accident.{x as string}on a plain host, on a host with a class binding, and on a customelement
{x}''and text → elementdom-template-text,helper-shadowing,binding-handoff*,signals-native-collection.abi,compiler-map-coverage,volar.perf-review(report below).Performance
Base is origin/main 385d6ab. Both sides used the same machine, commands, and browser.
pair.mjs(the PR bench harness), 30 pairs, both fixturesupdate1.023 [1.009, 1.036]. Isolatedupdaterepeats: 1.004, 1.014, 0.997. A/A control: 1.009, 1.014pair.mjs --work-only)tick1.004 (A/A rounds 0.984–1.017); every other tsrx op within 1%. JSXtick1.015, all 6 rounds above 1.0: about +36 µs on a 2.45 ms tick that does about 6,000 only-child writes, i.e. oneparentNoderead (~6 ns) per writebundle-size/run.mjs).tsrxoutput across the benchmark apps: net −3 B rawparentNodecheck 48;host.firstChild+nodeType58; React's check costs more than eitherTwo designs were measured and rejected:
gzip +190, and ForecastItem overflowed
bag14intobagOf. The changed bag shape alsomade tsrx
updateJIT-bimodal, ranging 0.878–1.090 over 6 runs.tick+4.3%, because class-bound cells paid tworeads per write.
Perf review: fix/translated-only-child-text (origin/main..cee9345)
Scan:
node scripts/perf-review-scan.mjs, 0 candidates.Hot paths touched:
setText: per text write. It gainshost !== undefined, plus oneparentNoderead when ahost is passed.
setText(null, value, host): per seeded{x as string}update on a host with no otherstored binding. One
firstChildread and onenodeTyperead instead of the cached Text.childTextHoleUpdateand the inline guard: per renderable only-child update. They passthe host.
bindSignalChild: per changed spread-host primitive. It gains anodeTyperead next toits existing
firstChildread.packages/octane/src/runtime.tssetTexttick+1.5% (~6 ns/write), everything else within noisepackages/octane/src/compiler/compile.jsonlyTextKeepsHost<template>text hosts (+1)setTextsetText(null, value, host)rather than a wrapper, so production calls stay level and the compiled output imports only fromoctaneCold paths:
resetOnlyChildHostandremoveOnlyChildTextrun only after an external editor on a mode switch. No new allocation on the hot paths, no scheduling change, no layout
reads.
Risk / follow-ups
parentNoderead is the cost of noticing an external edit at all. Reactpays three reads on the same path. In the densest text-update benchmark (dbmon JSX) it
shows up as about 1.5%; it does not show up on js-framework.
which then repeats on the next update. That is React's behavior too.
octane/signalsoutside a render has the same gap.That covers
writeDirectSignalBoundText,writeDirectSignalText, thebindSignalTextscalar path, and
updateDirectSignalChild, none of which has a React counterpart.touches different files.
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 the hot
setTextpath and DOM reconciliation for all only-child text bindings, with a small per-update DOM read cost; behavior is aligned with React but affects core rendering.Overview
Fixes stale translated text when Chrome’s page translator replaces an element’s sole
Textchild with<font>wrappers and detaches the original node. Octane kept updating that detached node; updates now detect translator DOM and reset the host (like React’ssetTextContent) before writing the new value.Runtime:
setTextaccepts an optional host; when the cachedTextis missing or no longer under the host,resetOnlyChildHostclears translator markup and re-attaches the binding’s text node. Renderable only-child holes,childTextHoleUpdate, and spread-host primitive paths pass the host through; mode switches to empty or element content clear translated wrappers instead ofremove()on a detached node.Compiler: Only-child text bindings emit host-aware
setTextcalls (onlyTextKeepsHostcan store the host instead of a separate_txtfield when no other binding owns it). Bag helpers gainhas/hasHostfor that layout.Tests: Differential vs React (10 cases), hydration after server render (5), plus a Chrome-like
translateTextHostshelper and.tsrxfixtures.Reviewed by Cursor Bugbot for commit 54f2356. Bugbot is set up for automated code reviews on this repo. Configure here.