Repository navigation
fix(octane): discard stale server text for an empty only-child hole - #1426
Merged
Merged
Conversation
A renderable `{expr}` hole that is its host's only child renders
markerless: the server serializes text as the host's bare text and every
empty value as no children. When the server rendered text but the client
value was `undefined`, a boolean, or `''`, hydration kept the server text
and reported nothing, so a later value rendered beside it (`<div>AB</div>`).
Three causes:
- childTextHole's markerless empty branch returned without looking at the
host's server children. The new HydrationCapability.hempty, htext's
empty counterpart, unwraps an empty `<!--[--><!--]-->` frame silently,
otherwise discards the server content and reports it once (recoverable
error plus the located dev warning). Dormant boundaries whose captures
changed repair without reporting, and a textarea is left alone because
its value props own its text.
- `null` bypassed that branch (`typeof null === 'object'`) and reached
childSlot. In a root component that took the root-return path and
abandoned hydration for the rest of the root, so a later only-child hole
duplicated its text; in a nested component the stale text stayed. `null`
now takes the markerless branch like the other empty values.
- The compiler seeded the hole's cached previous value with `undefined`,
so its first render skipped the hole entirely for an `undefined` value.
Only-child holes now seed the owning scope (the existing never-equal
`unset` seed, renamed from `style-unset`), so hydration always reaches
the hole. The steady-state update helpers are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
September 29, 2026 21:05
This was referenced Sep 29, 2026
trueadm
added a commit
that referenced
this pull request
Oct 5, 2026
…t signals (#1762) * perf(octane): stop shipping the signal binding runtime in apps without signals Since async signals (#1069) the compiler treated every opaque text, attribute, control and textarea hole, such as `{row.label as string}`, as a potential signal handle in every module. Every app therefore retained bindSignalText and the direct-binding engine and stamped signal identities on every component, even when it never created a handle. Opaque holes now bind handles only in modules that import from `octane/signals` (a type-only `SignalHandle` import is enough and does not enable native reads), in modules using DOM bindings, or everywhere with the new `opaqueSignalHandles` compiler option. `$`-named expressions still bind in every module. A dev-only error reports a handle that reaches a plain text hole. Gating exposed two plain-path hydration gaps that the signal path had been masking: a sibling or whole-output hole whose first client value is `undefined` kept the server content (the #1426 sentinel now seeds every hole), and an `undefined` first attribute value kept the server attribute (the IfChanged writers now apply the direct-signal path's hydration rule). Runtime gzip: rows 38,991 -> 37,307, TodoMVC 44,217 -> 41,076, chat 43,638 -> 40,347, weather 48,986 -> 47,270. Budgets lowered. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-lower byte budgets after merging main Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci(bench): re-lower minimal budgets after merging main Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(bench): opt scoped-signals harnesses that pass opaque handles into opaqueSignalHandles These workflow tests render real handles through ordinary props in modules without a signals import (late model-engine imports, opaque rows and attributes), which now binds only with the opaqueSignalHandles option. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): look through satisfies and instantiation wrappers for nested $ handles The syntactic-only capability check unwrapped as/!/parentheses but not `satisfies` or instantiation expressions, so `(a ?? b$) satisfies T` stopped binding `b$` in a module without a signals import. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: update signal-capable mapping and writer tests for the opaque-handle gate signals-dom-bindings passes handles through ordinary props in an untyped module, so it opts into opaqueSignalHandles. The playground mapping rows for signal-free modules now map to the plain writers, and a signals-importing variant keeps the named writer-record targets covered. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A renderable
{expr}hole that is its host element's only child rendersmarkerless: the server writes text as the host's bare text and every empty value
as no children at all. When the server rendered text but the client value was
undefined,false,true, or'', hydration kept the server text and reportednothing. A later render then produced
<div>AB</div>.Server-rendered with
{ kind: 'text', v: 'A' }and hydrated with{ kind: 'undefined' }: theAstayed,onRecoverableErrornever fired, andrendering
{ kind: 'text', v: 'B' }gave<div>AB</div>.nullonly looked correct. It skipped the markerless branch (typeof null === 'object') and reachedchildSlot. In a root component,childSlot's root-returncheck then called
abandonRoot, which gave up hydration for the rest of the root:a later only-child hole rendered
<b>tt</b>, and the dev warning said "expected arenderable root". In a nested component,
nullleft the stale text just likeundefineddid.There were three causes, and the fix needs all three:
childTextHole: the markerless empty branch returned withoutlooking at the host's server children. The new
HydrationCapability.hemptyishtext's counterpart for empty values:<!--[--><!--]-->frame silently, since the server framesan empty ternary arm.
onRecoverableError, plus the dev warning with the hole's location ("theclient expected nothing but the server rendered text "A"").
<Hydrate>boundary whose captures changed before activationrepairs without reporting (
staleServerValues).<textarea>is left alone because itsvalue/defaultValueprops own itstext. Six existing textarea hydration tests fail without that guard.
nullrouting:nullnow takes the markerless branch with theother empty values, matching
ssrChildText, which already writes every emptyvalue the same way.
(
_chp) withundefined, sochildTextHoleUpdateand the@forinline guardskipped the first render whenever the value was
undefined. Only-child holes nowseed the owning scope instead, using the existing never-equal seed that style
scalars use (
'style-unset', renamed to'unset'). The steady-state updatehelpers are unchanged.
Validation
pnpm format:check: only the scopedpnpm format:files:checkran on the changed files, and it passed.pnpm typecheck: only the scopedpnpm typecheck:filesran onruntime.ts,compile.js, and both fixtures, and it was clean.mismatch-structural.test.tsalready had 8 implicit-anyerrors onmain, all in lines this PR doesn't touch.pnpm test: not green locally. The single-process run hits the V8 heap limit on this machine, with timeouts before the abort. Shard 1/4 ofvitest.ci-sharded.config.jsran before the rebase with 9,063 passed and 2 failed. The two failures were a CLI version timeout andstreamdown/highlight-race, which passes 3/3 in isolation. Shards 2–4 were stopped for the rebase and did not run, so CI is the full-suite evidence.d455cb18c, all ofpackages/octane/tests/hydrationplus the textarea and behavior-root suites pass inoctaneandoctane-prod: 166 files, 3,498 tests.--project octane --project octane-prodhad 4 failures out of 25,059. All were load timeouts or their follow-on errors, and they pass in isolation.mismatch-structural.test.ts("only-child renderable hole whose client value is empty"), in dev and prod compile. They cover all five empty values in root and nested components,.tsxframed text, a keyed@forrow (inline guards),bindSignalChildlowering, matching empty values staying silent, and a dormant<Hydrate>boundary. Each test asserts final DOM, reuse of the adopted server nodes, later renders,onRecoverableError, and the dev warning.hemptycall: 100 failures;nullthroughchildSlotagain: 18;undefinedseed: 16;benchmarks/codegen-size): raw 218,173 → 218,192 bytes (+19), minified +5, gzip +1. The benchmark script's rspack CSS-modules step fails the same way on the baseline, so these totals come from its corpus loop.Risk / follow-ups
@forlowerings, an only-child hole whose firstvalue is
undefinednow callschildTextHoleonce at mount. Anullhole nolonger allocates
childSlotstate, and steady-state updates are untouched. Nowall-clock measurement was taken because the difference would sit inside noise.
suppressHydrationWarningdoes not keep the server text here. The discard isstructural, like
htext's extra-children removal, and matches React'stail-node check for
null/undefined/boolean children. React would keep theserver text for a literal
''under suppression; Octane renders''asnothing, like the other empty values.
_chpwithundefined, so theirfirst render skips
textHoleforundefinedin the plain lowering. Thatmatters for the sibling-position element→text work in progress, which relies on
childSlotrunning.same
abandonRootmisfire in a root component and leaks in a nested one. It isa different path and is being handled in its own task.
Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes core hydration reconciliation for markerless text holes; behavior is narrow but affects first-paint DOM and error reporting, with extensive targeted tests.
Overview
Fixes hydration when a renderable
{expr}is the only child of its host and the server sent text but the client value is empty (null,undefined, booleans, or''). Stale text was left in the DOM (e.g.<div>AB</div>on the next update) with no recoverable error;nullat the root could abandon hydration for sibling holes.The runtime adds
hempty, called from the markerless empty path inchildTextHole: it strips server text (or an empty comment frame), firesonRecoverableErroronce, and in dev warns with source location.nullnow follows the same markerless path as other empty values instead ofchildSlot/abandonRoot. Dormant<Hydrate>boundaries with legitimately stale captures still repair silently;<textarea>hosts are skipped.The compiler seeds only-child holes’ cached previous value with
unset(renamed fromstyle-unset) so the first hydrating render always runs the hole logic even when the value isundefined. Broad regression tests cover root/nested components,.tsx,@for, signal bindings, and dormant boundaries (dev and prod compile).Reviewed by Cursor Bugbot for commit 3a0f724. Bugbot is set up for automated code reviews on this repo. Configure here.