Repository navigation
feat(compiler): allow zero-argument binding views - #1568
Conversation
A 'use dom bindings' view that reads only module-scope signal handles may now declare no props parameter, as an independent island does. It compiles for adoptBindings, mountBindings and server rendering like a view with props; views with more than one parameter are still rejected. A bundle-boundaries guard builds such an island in production for TSRX and TSX, asserts its graph excludes the renderer (with a hydrateRoot control), and adopts real SSR output through clicks, signal writes and disposal. Refs #1514 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Benchmark report🟢 No size increases and no timing regressions outside noise. Compares js-framework: 1k/10k row operations (ms, lower is better)All 20 timed operations (20 within noise)
Application bundle size (bytes)No changes across 45 measured values. Public-import reachability bundles (bytes)No changes across 105 measured values. CI job durations
Compares the CI run for The run concluded
Not compared (skipped, failed, or not run on this pull request): React parity checks, Lynx compatibility (minimum), Lynx compatibility (current), heavy integration (astro), heavy integration (browser), heavy integration (package-builds), Three compatibility (current), heavy integration (eval-corpus), Three compatibility (minimum r156), test shard (Node 22.22.2, 1/4), heavy integration (runtime-loaders), test shard (Node 22.22.2, 3/4), test shard (Node 22.22.2, 2/4), test shard (Node 22.22.2, 4/4), test (24), test (22), CI provenance. All 22 timed jobs
|
Summary
'use dom bindings'view may now declare no props parameter. Independent islands read module-scope signal handles rather than props, so this gate rejected every island the Renderer-free island activation: binding-view gates and an islands-only route mode #1514 audit found. Views with more than one parameter are still rejected.Why
Changes
packages/octane/src/compiler/dom-bindings.js: drop therequired && params.length !== 1clause and reword the diagnostic. Views with two or more parameters still fail with "ordinary props parameter".packages/octane/tests/behavior-root.test.ts: zero-argument views over module signals (a scalarLabeland aCounterwith a click handler) adoptrenderToStringoutput early, rehydrate throughhydrateRootwith no diagnostics, and mount fresh, in dev and prod. Also a two-parameter rejection.benchmarks/scoped-signals/bundle-boundaries.test.mjs: new CI guard "zero-argument island views adopt module signals without the renderer", for TSRX and TSX. It builds a production island that uses the publicadoptBindingsand imports its state from a separate module, and asserts the renderer is not in its esbuild graph. AhydrateRootbuild of the same view is the positive control. The island adopts real SSR output and is exercised through a click, signal writes and disposal.docs/deferred-hydration.md, and a Renderer-free island activation: binding-view gates and an islands-only route mode #1514 progress table indocs/hydration-islands-plan.md.octanepatch.Activation still takes a
BindingSource; a zero-argument view never reads its snapshot. Making the source optional would be a public API change, so it is left out. Step 6's generated activator can pass a constant source.Performance audit
Existing views: the change only narrows a rejection predicate. Every view accepted before is accepted now and compiles through the same code, so output for one-parameter views is unchanged.
Compiled artifact, same view with and without
props: binding artifact 1,171 B / 519 B gzip (zero-argument) vs 1,183 B / 522 B gzip (props). Ordinary component output 1,493 B / 654 B vs 1,491 B / 653 B.Bundle guard diagnostics (esbuild, production, minified, gzip-9):
adoptBindings(signals engine + binding program, no renderer)hydrateRoot(control)These are synthetic reachability numbers, not page savings: a real route still hydrates its shell with the renderer until step 6.
Baseline for step 6:
examples/signal-chatproduction build on main @ 4ab33b6 (before the merge) is 156.4 KB gzip-9 of client JS, with the renderer chunk at 96.1 KB (61%).Validation
All on the merged head (current
origin/mainmerged in).pnpm format:check: not run repo-wide.pnpm format:files:checkpasses on every changed file.pnpm typecheck: the full run was stopped at a 30-minute limit under heavy machine load, so it did not finish. These passed instead:octane-tsc -p packages/octane/tsconfig.jsonpnpm typecheck:fileson the changed source and test files, which reports only the two existing errors inbehavior-root.test.tsat lines 3479 and 3711, outside this diff.pnpm test: not run in full locally; CI runs it.behavior-root.test.ts: the zero-argument, rejection and fix: diagnose eager imported signal samples in DOM bindings #1304 read-diagnostic tests, in both theoctaneandoctane-prodprojects. Two of the diagnostic tests timed out once under that load (20+ s); rerun alone, all 8 of their runs pass.node --test benchmarks/scoped-signals/bundle-boundaries.test.mjs: 32/32 pass.pnpm syncleaves the tree clean.Plan for the rest of #1514 (not in this PR)
constaliases once per fragment, including in@if/@forarms; today they are copied into every projector and arm-local declarations are rejected..latest(fallback), and drop the Port the Base UI list-navigation and typeahead infrastructure (Phase 3e) #308 diagnostic where reads become subscribed.useLayoutEffect(cb, [])becomes a new activation adapter kind, not a ref. It runs once after the whole tree activates, child before parent, under the captured owner, and its cleanup runs on dispose. Thereadyflag pattern is lowered too.@try/@pending/@catch:tryregion kind whose arm is selected by the step-3 reads: a thrown thenable selects@pending, any other error selects@catch.reset.?octane-island=artifact compiled from the view's own module, which falls back to the renderer activator without the directive. A renderer-free activator adopts the island range and replays captured intents;cloneHydrationReplayEventmoves out ofruntime.ts.octane; full routes keep today's entry..get()in the audited islands sits inside a@tryarm, so those islands need steps 3 and 5 together.Risk / follow-ups
docs/hydration-islands-plan.md.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 a compile-time rejection rule; runtime and one-parameter binding output stay the same, with new tests guarding renderer-free adoption.
Overview
'use dom bindings'views can omit the props parameter when they only read module-scope signals (typical island state). The binding compiler no longer requires exactly one props argument; views with two or more parameters still fail. One-parameter views compile unchanged.This is step 2 of renderer-free island activation (#1514): it unlocks binding compilation for no-props islands but does not remove renderer bytes from real routes until later steps.
Coverage:
dom-bindings.jsdiagnostic text update;behavior-root.test.tsfor adopt,hydrateRoot, and mount over module signals;bundle-boundaries.test.mjsasserts TSRX/TSX islands usingadoptBindingsstay off the renderer graph (withhydrateRootas control). Docs note thatBindingSourceis still required and its snapshot is unused for zero-arg views; the islands plan marks step 2 done.Reviewed by Cursor Bugbot for commit c3469d9. Bugbot is set up for automated code reviews on this repo. Configure here.