Skip to content

Commit 9081107

Browse files
committed
fix(solid): golf the #4372 clear; record its hydrating scenarios over next
A `placeholder(id)` helper serves the region capture and the two existing `pl-*` lookups, so the fix costs +42 B minified in hydrating bundles (from +85 B) and 0 B in every CSR scenario and the non-hydrating floors. The three scenarios that sat at their recorded minified get a dated ledger line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
1 parent f16aa73 commit 9081107

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎packages/solid/src/client/hydration.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,9 +2589,12 @@ function fragmentSuperseded(id: string): boolean {
25892589
const hy = (globalThis as any)._$HY;
25902590
if (hy && hy.v && hy.v[id]) return false;
25912591
if (document.getElementById(id)) return false;
2592-
return !!document.getElementById("pl-" + id);
2592+
return !!placeholder(id);
25932593
}
25942594

2595+
/** A fragment's `pl-*` placeholder, while its range is still in the document. */
2596+
const placeholder = (id: string) => document.getElementById("pl-" + id);
2597+
25952598
/**
25962599
* A settled declaration whose swap has not run yet: its content template and
25972600
* `pl-*` placeholder are both still in the document. `$dfs` holds a swap like
@@ -2600,7 +2603,7 @@ function fragmentSuperseded(id: string): boolean {
26002603
function fragmentParked(id: string): boolean {
26012604
const hy = (globalThis as any)._$HY;
26022605
if (hy && hy.v && hy.v[id]) return false;
2603-
return !!document.getElementById(id) && !!document.getElementById("pl-" + id);
2606+
return !!document.getElementById(id) && !!placeholder(id);
26042607
}
26052608

26062609
function whenRevealed(id: string, cb: () => void) {
@@ -3028,8 +3031,8 @@ function hydratedCreateLoadingBoundary<T, U>(
30283031
// adopts it.
30293032
const revealed = hy.v?.[id];
30303033
// The region the claimed fallback stands in, read before a swap takes
3031-
// the placeholder range.
3032-
const region = revealed ? null : document.getElementById("pl-" + id)?.parentNode;
3034+
// the placeholder range (none once revealed).
3035+
const region = placeholder(id)?.parentNode;
30333036
waitAndResume(
30343037
fr,
30353038
shouldHydrate =>

‎scripts/size/scenarios.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,8 +2659,9 @@ module.exports = [
26592659
// A displaced guess comes back with its taker's revert; a fallback's `latest()` does not pull a held swap ahead (#4336 / #4337, 2026-10-28, re-measured over next @ 1f558e50 after merging it): 31.19 -> 31.80 KB, recorded minified 95,595 -> 96,944 B (+1,361 B over next measured locally: +650 B is #4336's accepted exception above, +711 B this change), measured locally (linux) at 31,790 B brotli. Lanes (behind `guessed`, folded in every build without an optimistic write): a lane taking another action's guess keeps it aside (`take`; a store target's other guessed slots taken with it but not written, so the revert's re-ask is a question nothing stands in for), its readers re-derive with the lane (the split-effect form waits instead of showing `#1:` beside the guess), a correction that reverts marks its lane (`reverted`, a WeakSet: no new mangled field), and the landing of that lane's parent re-seats each guess still alive over the truth it lands (`endLanes`; a store slot on the node the slot has now, `_slotTake(n, true)`) in the same frame. Boundaries (+41 B in every build with a boundary, ≤ next except the lane pages: live +2 B, compiled live +9 B, live + router +2 B over next): the fallback read keeps the output's lane seat and verdict bits. Measured alternatives: restoring at the dissolve instead of the landing tore (`#1: dana | mine (sending)`); restoring without re-seating released store slots lost row 0 and the untracked read; reading the fallback with no observer broke #2701/#2949/#3540 pins; a `_reverted` field on the lane (-41 B here) renamed the mangled props and moved every other scenario's brotli by +1..+16 B; passing the revert to `supersede` as an argument (-26 B here) cost `+ isPending/latest` 5 B; an AND-mask for the fallback's flags (-5 B minified) cost the boundary apps up to +63 B brotli. Correctness; Size-Exception accepted by the maintainer 2026-10-28. Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured; CI re-bases.
26602660
// A projection unchained from a store proxy tells its readers (#4361, 2026-10-28, over next @ 6b7e34a, after #4337): cap 31.80 KB unchanged, recorded minified 96,944 -> 96,958 B (+14 B minified over next); measured over next @ ffe0c1c5 at +1 B brotli. A keyed projection whose derive returned another store's proxy, then a plain array, reconciled the array against the live proxy, which already read the source's next frame, so no leaf or container heard the change and the frame stalled; a live chained base now writes every node (node equality judges each) and its container. Correctness. Recorded minified = measured; CI re-bases.
26612661
// Derived-store leaf served its staging while the derive has never committed (#4355, 2026-10-28, over next @ 5f60713a, after #4361): cap 31.80 KB unchanged, recorded minified 96,958 -> 96,977 B (+19 B), measured locally (linux) at 31,743 B brotli, under the cap. A verdict reader (a memo over a derive that reads `latest()`) was served a never-landed derived store's seed for one pass; the store's `nodeValue` now serves the leaf's staging while the family's derive is uninitialized (+19 B minified, store engine only). Correctness.
2662+
// A rejected fragment's clear keeps a sole text slot (#4372, 2026-10-28, over next @ 40cde2cd): cap unchanged, recorded minified 96,977 -> 97,019 B (+42 B minified over next), measured locally (linux). A rejected streamed fragment's clear gives a region it empties back an empty text node, so an insert that claimed a text fallback as its sole child writes its next value there instead of to a missing node (Cannot set properties of null, REACTIVITY_HALTED). Hydration-only: the CSR scenarios and the floors without hydration pay 0 B. Recorded minified = measured.
26622663
limit: "31.80 KB",
2663-
capMinified: 96977,
2664+
capMinified: 97019,
26642665
alias
26652666
},
26662667
{
@@ -5737,8 +5738,9 @@ module.exports = [
57375738
// Bug-fix batch (2026-10-26, over next @ 95dd480f): 41.47 KB -> 41.56 KB, recorded minified 123,120 -> 123,192 B (+72 B), measured in CI at 41,547 B brotli. Same growth as the live floor: the 2026-10-26 bug-fix batch: #4279 hydrated Errored runs its content in the hydration pass (+82 B minified), #4281 latest()-first throw (+51), #4280 derived store follows a memo's pending/errors (+15), #4277 outer boundary recovers after an inner rethrow (+11), #4278 per-key isPending (+11), net of #4261 moveBefore (-39) and layout. Accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
57385739
// Off-screen fallback disposed in the pass that picks content (#4282 / #4268, 2026-10-26, over next @ fbd375d1): cap 41.56 KB unchanged, recorded minified 123,192 -> 123,216 B (+24 B; +24 B over next), measured in CI at 41,531 B brotli. A re-armed Loading disposes a fallback its committed output does not show in that pass, so the fallback's pending render effects stop holding the frame. Size-Exception accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
57395740
// An isPending() probe wakes a dormant memo outside its window (#4366, 2026-10-28, over next @ 5f60713a): cap 41.56 KB unchanged, recorded minified 123,216 -> 123,182 B (+6 B minified over next), measured locally (linux) at 41,831 B brotli. A lazy or dormant memo (an unowned memo left with no reader) woken by a read inside `isPending`/`latest` recomputed inside the probe's window, so it derived from its sources' committed values; the wake now runs outside it, as a pull does (A31). Correctness. Recorded minified = measured; CI re-bases.
5741+
// A rejected fragment's clear keeps a sole text slot (#4372, 2026-10-28, over next @ 40cde2cd): cap unchanged, recorded minified 123,182 -> 123,224 B (+42 B minified over next), measured locally (linux). A rejected streamed fragment's clear gives a region it empties back an empty text node, so an insert that claimed a text fallback as its sole child writes its next value there instead of to a missing node (Cannot set properties of null, REACTIVITY_HALTED). Hydration-only: the CSR scenarios and the floors without hydration pay 0 B. Recorded minified = measured.
57405742
limit: "41.56 KB",
5741-
capMinified: 123182,
5743+
capMinified: 123224,
57425744
alias: pageAlias
57435745
},
57445746
{
@@ -6118,8 +6120,9 @@ module.exports = [
61186120
// Bug-fix batch (2026-10-26, over next @ 95dd480f): 47.01 KB -> 47.11 KB, recorded minified 140,402 -> 140,456 B (+54 B), measured in CI at 47,099 B brotli. Same growth as the live floor: the 2026-10-26 bug-fix batch: #4279 hydrated Errored runs its content in the hydration pass (+82 B minified), #4281 latest()-first throw (+51), #4280 derived store follows a memo's pending/errors (+15), #4277 outer boundary recovers after an inner rethrow (+11), #4278 per-key isPending (+11), net of #4261 moveBefore (-39) and layout. Accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB; recorded minified = measured.
61196121
// Off-screen fallback disposed in the pass that picks content (#4282 / #4268, 2026-10-26, over next @ fbd375d1): 47.11 KB -> 47.16 KB, recorded minified 140,456 -> 140,480 B (+24 B; +24 B over next), measured in CI at 47,148 B brotli. A re-armed Loading disposes a fallback its committed output does not show in that pass, so the fallback's pending render effects stop holding the frame. Size-Exception accepted by the maintainer (2026-10-26). Cap at measured + 10 B rounded up to 0.01 KB, never lowered; recorded minified = measured.
61206122
// An isPending() probe wakes a dormant memo outside its window (#4366, 2026-10-28, over next @ 5f60713a): cap 47.16 KB unchanged, recorded minified 140,480 -> 140,442 B (+24 B minified over next), measured locally (linux) at 47,465 B brotli. A lazy or dormant memo (an unowned memo left with no reader) woken by a read inside `isPending`/`latest` recomputed inside the probe's window, so it derived from its sources' committed values; the wake now runs outside it, as a pull does (A31). Correctness. Recorded minified = measured; CI re-bases.
6123+
// A rejected fragment's clear keeps a sole text slot (#4372, 2026-10-28, over next @ 40cde2cd): cap unchanged, recorded minified 140,442 -> 140,484 B (+42 B minified over next), measured locally (linux). A rejected streamed fragment's clear gives a region it empties back an empty text node, so an insert that claimed a text fallback as its sole child writes its next value there instead of to a missing node (Cannot set properties of null, REACTIVITY_HALTED). Hydration-only: the CSR scenarios and the floors without hydration pay 0 B. Recorded minified = measured.
61216124
limit: "47.16 KB",
6122-
capMinified: 140442,
6125+
capMinified: 140484,
61236126
alias: pageAlias,
61246127
conditions: solidConditions,
61256128
compile: { hydratable: true }

0 commit comments

Comments
 (0)