Repository navigation
fix(octane): don't report an empty style attribute an early binding left - #1861
Merged
Merged
Conversation
A module that imports octane/signals compiles every non-literal style, such as
a forwarded style={props.style}, to nativeStyleBinding, because the value might
carry signal handles. The binding then allocated and rendered a control-flow
Block even for undefined, null or a string, which carry no native read. A
production audit of a signed-out home page found 273 such Blocks in one
hydration (about 8 ms at 4x CPU throttling).
Any non-object value now takes the existing scalar writer while the binding has
no Block, whatever the compiler's literal flag. Presentation hydration prepares
the same plain style takeover write without a Block or read witness. The
existing upgrade still allocates the Block, seeded with the last applied style,
once a structured value arrives; the Block then stays, so a later unset style
releases its subscriptions through its own transactional render.
hydrateClaimedBindingCaches dereferenced binding.block for every native style
claim. A Block-less scalar style literal in a signal-enabled binding view made
hydration throw, so the host was rebuilt on the client; it now updates the
binding's own cache.
nativeProjectionBinding is unchanged: the compiler emits it only for
projections that syntactically read handles, so its Block owns real reads.
The signal-dom-bindings bench gains a forwarded-style lane with ratio guards:
style Blocks 2 -> 0 and native style bodies 200 -> 0 per 100 updates.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hydration
An early binding that owned a whole style (`style={props.style}`, a
`styleObject` channel) never recorded a claim for hydration. Development
therefore reported its publication as a mismatch, and hydration cached the
skipped write as applied: after the binding was released, a render back to the
hydration-time style did not write it, so the early value stayed on screen.
The fixed-layout adopter now publishes a whole style's canonical CSS text, and
keepsStyle treats a matching whole-style claim as the server's value, as it
already did for single declarations. hydrateClaimedBindingCaches already
invalidates the renderer's cache for a claimed `style` channel.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng-claim # Conflicts: # packages/octane/tests/binding-handoff.test.ts
The repository's test-marker check forbids `it.runIf`. The emptied-publication case applies only to a whole style, so it now has its own describe over dev/prod and signals-free/signals-enabled views. The view, props and early adoption helpers it shares with the main matrix are hoisted into `adoptedStyleView`, so every registered test runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When an early binding publishes a single style declaration as unset before
hydration, removing that declaration can leave `style=""` on the element.
keepsStyle removed the claimed declaration from the expected style, but its
attribute-presence check still reported the empty attribute in development
("the server rendered "", the client """).
A claimed removal now also exempts the attribute's presence. The claims loop
writes the claimed value through setProperty, since an empty value removes the
declaration, and the presence check reduces to "nothing expected, nothing
removed, and an attribute is present", which is equivalent given the cssText
comparison before it. Net -14 raw bytes on hydrate-root, deferred-hydration
and hydrate-frame.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 7, 2026 20:30
…nto fix/unset-style-claim-presence # Conflicts: # packages/octane/tests/binding-handoff.test.ts
Contributor
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)
56 other measured values are unchanged. Public-import reachability bundles (bytes)❌ 1 value(s) exceed their committed budget. Reduce the growth, or raise the budget in a separate pull request that names the bytes and the reason (CONTRIBUTING.md, "Size budgets").
102 other measured values are unchanged. |
…-presence # Conflicts: # packages/octane/src/runtime.ts # packages/octane/tests/binding-handoff.test.ts
4 of 7 tasks
domgan-oai
pushed a commit
that referenced
this pull request
Oct 7, 2026
…1869) Budget-only raise, landing ahead of #1861 per CONTRIBUTING "Size budgets". main 43b60d9 measures deferred-hydration at exactly its 69,610 gzip budget (#1857 and #1859 filled the headroom). #1861 stops development hydration reporting an empty style attribute that an early binding left behind, and measures 69,612 gzip there (-14 raw, +2 gzip). 69,642 is main's measured + 32, the highest value the ratchet accepts against main, so no other pull request fails the ratchet while #1861 is open. 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
Development hydration no longer reports an empty
styleattribute that an early binding left behind. This builds on #1859, now merged, and needs the budget-only raise #1869 to merge first.Repro: in a
'use dom bindings'view withstyle={{ opacity: props.opacity }}, server-render opacity 1. An early binding (adoptBindings) then publishes opacity as unset, andhydrateRootruns. Development logged:Why
HydrationCapability.keepsStyletreats a claimed early-binding declaration as the server's value. The claims loop removes the claimed declaration from the expected style.style=""on the element, the same as the renderer's own style writer does.hasAttribute('style') !== (expected !== '')then reported that empty attribute. The early binding left it, not the server.Changes
keepsStyleinpackages/octane/src/runtime.ts:removed, and the presence check is skipped when it is set.setProperty. Per CSSOM, an empty value removes the declaration, so this drops the separateremovePropertybranch.!expected && !removed && hasAttribute('style'). It runs only after theserver !== expectedcomparison, so it is equivalent to the old one: a non-empty cssText implies the attribute is present.style=""that the binding did not leave still reports. That is the case where the binding published a declaration and something else removed it.packages/octane/tests/binding-handoff.test.ts, built on #1859'sadoptedStyleViewhelper:keeps a style the early binding emptied without a reportnow sits in the mainadopted style publicationmatrix (dev/prod compile × native/ordinary × literal/forwarded), hydrating with opacity1and withundefined. Before the fix it failed in all 4 dev/literal cases with the report above. It replaces fix(octane): keep an early binding's whole-style publication through hydration #1859's forwarded-onlyadopted whole style publicationdescribe and covers more.adopted style declaration publication(literal, dev/prod × native/ordinary):reports an empty style attribute that the early binding did not leave. It pins the neighbouring behavior. It fails if the exemption is widened to any claimed element (checked with a mutant:!claimsin place of!removed). It is literal-only because a forwarded style with the ordinary writer skips the comparison when the client style is unset. That gap predates this change. Noit.runIf:pnpm test:markers:checkpasses.Size, measured locally on top of #1859 with
node benchmarks/bundle-size/run-minimal.mjs. The earlier flag-only formulation measured +16 raw / +9 gzip onhydrate-root.Stacked with #1857's head as well, every row stays within the current budgets:
hydrate-root137,834 / 44,108 against 137,859 / 44,129, anddeferred-hydration221,130 / 69,609 against 221,155 / 69,610.hydrate-frameraw depends on the checkout path, so its CI shard 1/4 number is the reference.Validation
pnpm format:check(not run repo-wide;pnpm format:files:checkon the changed files passes)pnpm typecheck(not run repo-wide;pnpm typecheck:fileson the changed files passes)pnpm test(not run locally; CI runs it)binding-handoff.test.tspasses in--project octane(94) and--project octane-prod(94).scalar-dom-bindings.test.tsandhydration/document-lifecycle.test.tspass in--project octane.pnpm syncleaves the tree clean.Risk / follow-ups
main43b60d9 (with perf(runtime): enter each Block's signal owner in place during render #1857 and fix(octane): keep an early binding's whole-style publication through hydration #1859) measuresdeferred-hydrationat exactly its 69,610 gzip budget, and this PR measures 69,612. Until ci(bundle-size): raise the deferred-hydration gzip budget for #1861 #1869 raises that budget to 69,642 (main's measured + 32), shard 1/4 fails on that row. Then mergemainhere.hydrate-root(137,834 / 44,108 against 137,859 / 44,129) andhydrate-frame(366,315 / 113,385 against 366,340 / 113,408) fit with the ratchet. I tried 30 gzip-neutral spellings first; the best reached 69,611.setPropertywith an empty value. It removes the declaration in browsers, jsdom and happy-dom, and ViewTransition's staged style proxy forwards it to the native declaration.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Narrows dev-only hydration mismatch detection for early style bindings; production hydration behavior is unchanged and behavior is covered by targeted tests.
Overview
Development hydration no longer logs a spurious
stylemismatch when an early binding (adoptBindings) cleared its only style declaration and leftstyle=""on the element.keepsStylenow tracks when a claimedstyle:*declaration was removed via CSSOM and skips the empty-attribute presence check in that case, while still warning ifstyle=""remains but the early binding did not create it. Claimed values are applied uniformly throughsetProperty(empty values drop the declaration).Tests in
binding-handoff.test.tscover hydrating after the binding empties the style (no dev warning) and the case where something else removed the binding’s declaration (dev still warns). A patch changeset documents the fix.Reviewed by Cursor Bugbot for commit 2a7f557. Bugbot is set up for automated code reviews on this repo. Configure here.