Skip to content

feat(runtime): install hydration-time insert/event behaviors from hydrate() - #544

Merged
ryansolid merged 1 commit into
nextfrom
hydration-read-hooks
Jul 15, 2026
Merged

ryansolid merged 1 commit into
nextfrom
hydration-read-hooks

Conversation

@ryansolid

Copy link
Copy Markdown
Owner

Part of solidjs/solid#2883 (last mile). The hydration-only behaviors reached from hot client paths — insert()'s initial claim and swapped-region reclaim walk, insertExpression's hydration gate, eventHandler's replay dedup — move behind a nullable hydrationRt slot installed by hydrate().

Measured on the minimal-app fixture with identical runtime bases (real package resolution, gzip -9):

  • esbuild-class bundlers: −452 min / −194 gz (these guards aren't foldable without Rollup's literal tracking)
  • Rollup/Vite: byte-identical — it already proved these paths dead via sharedConfig object-literal tracking

installHydrationRuntime() is exported for tests/embedders that simulate mid-hydration state directly (the nested-roots replay spec now uses it).

All 606 runtime tests pass.

🤖 Generated with Claude Code

…rate()

insert()'s initial claim + swapped-region reclaim, insertExpression's
hydration gate, and eventHandler's replay dedup move into a runtime slot
assigned by hydrate(), so CSR bundles shake the bodies. Rollup-class
bundlers already folded these paths (sharedConfig literal tracking) and
measure byte-identical; esbuild-class bundlers drop ~450 min / ~194 gz.

installHydrationRuntime() is exported for tests/embedders that simulate
mid-hydration state without entering through hydrate().

Co-Authored-By: Claude Fable 5 <[email protected]>
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

ryansolid added a commit to solidjs/solid that referenced this pull request Jul 15, 2026
Rollup literal-tracks never-written module state and folds the dead
branches; esbuild cannot, so these paths shipped only to esbuild-class
consumers. Restructured so both bundlers land in the same place, all
Rollup-neutral by measurement:

- external-source wiring (computed setup + untrack) moves behind
  GlobalQueue hooks whose installs mirror enableExternalSource()'s
  config liveness exactly (installed on enable, removed on reset)
- onlyMarkPending moves from async.ts into affects.ts behind the
  activeAffectsMarks-gated hook (mark-transparency is affects-only)
- the optimistic-store settle loop moves inside the store-side hook
  (_clearOptimisticStores takes the batch; scheduler keeps a
  size-guarded call)

esbuild minimal app: -77 gz from these + -194 gz from the companion
dom-expressions hydration-hook change (ryansolid/dom-expressions#544).

Co-Authored-By: Claude Fable 5 <[email protected]>
ryansolid added a commit to solidjs/solid that referenced this pull request Jul 15, 2026
…ups (#2883) (#2890)

* feat(signals,solid): pay-for-use tree-shaking phase 3 (#2883)

Mechanical cleanups chosen by the phase-3 cost/benefit audit (delegation
seam and snapshot seam rejected by design ruling / weight gate):

signals:
- dedupe effect re-enqueue block (4 copies) + zombie/dirty queue ternaries
  into enqueueSub/queueFor; hot write loop microbenched, no regression
- _-prefix boundary/reveal internal method names so property mangling
  reaches them (verified internal-only)
- trim prod error strings to diagnostic codes; dev keeps full sentences
- stop stripping /*@__PURE__*/ from dist/prod: drop rollup-plugin-prettier
  from the prod tree (it deletes annotations), terser preserve_annotations
  in mangle-props.mjs, new scripts/check-pure.mjs fails the build if
  annotations vanish again

solid-js client:
- sharedConfig.getNextContextId installs from enableHydration(); defining
  it in the object literal retained context/error machinery in every CSR
  bundle (SharedConfig.getNextContextId now optional)
- lazy()'s hydration-module lookup moves behind _lazyHydrationLookup,
  installed by enableHydration()
- MockPromise: class static block defeated DCE in every client bundle;
  now a PURE-annotated factory

packaging: unpkg/jsdelivr fields point at browser prod ESM (were CJS,
browser-fatal on bare CDN URLs)

Measured (esbuild, minify, mangle-props ^_, gzip -9):
- minimal app: 27,570/10,870 -> 26,429/10,432
- CSR app (+Loading/lazy): 35,565/13,935 -> 32,067/12,601 (incl.
  DOMElements dedup propagating through rebuilt web runtime)
- signals floor: 18,921/7,687 -> 18,539/7,515
- full bundle: 55,366/20,587 -> 54,587/20,315 (hook-tax clawback)

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(signals): close esbuild-shakeable gaps at the source level (#2883)

Rollup literal-tracks never-written module state and folds the dead
branches; esbuild cannot, so these paths shipped only to esbuild-class
consumers. Restructured so both bundlers land in the same place, all
Rollup-neutral by measurement:

- external-source wiring (computed setup + untrack) moves behind
  GlobalQueue hooks whose installs mirror enableExternalSource()'s
  config liveness exactly (installed on enable, removed on reset)
- onlyMarkPending moves from async.ts into affects.ts behind the
  activeAffectsMarks-gated hook (mark-transparency is affects-only)
- the optimistic-store settle loop moves inside the store-side hook
  (_clearOptimisticStores takes the batch; scheduler keeps a
  size-guarded call)

esbuild minimal app: -77 gz from these + -194 gz from the companion
dom-expressions hydration-hook change (ryansolid/dom-expressions#544).

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
@ryansolid
ryansolid merged commit 03edc32 into next Jul 15, 2026
2 checks passed
@ryansolid
ryansolid deleted the hydration-read-hooks branch July 15, 2026 20:39
ryansolid added a commit that referenced this pull request Jul 15, 2026
…id#2883)

Bundles import-subset fixtures from src/client.js with rxcore external
(measuring only this package's tree-shaken contribution) and fails when
gzip cost exceeds committed ceilings with ~5% headroom. The compiled-JSX
core scenario excludes the hydrate()-installed runtime — the property
#544 established and this guard keeps.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant