Skip to content

Commit fd13b7d

Browse files
ryansolidnickshirocursoragent
committed
fix(signals): register the #3767 draft alias through a shared setLookup helper; drop the cap raises
createTarget, adoptPB and wrapDraft share one lookup-registration helper; brotli is roughly neutral, so every scenario fits its existing cap. Co-authored-by: Nick <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 2778ae6 commit fd13b7d

5 files changed

Lines changed: 11 additions & 20 deletions

File tree

‎packages/signals/src/store/projection.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type { Computed, Signal } from "../core/types.js";
3333
import type { Refreshable } from "../core/index.js";
3434
import { reconcileState } from "./reconcile.js";
3535
import { nameStore, runDirect, storeSetter, wrap } from "./store.js";
36-
import { storeLookup, type StoreFamily, type StoreTarget } from "./target.js";
36+
import { setLookup, type StoreFamily, type StoreTarget } from "./target.js";
3737
import {
3838
$TARGET,
3939
markRawIngest,
@@ -120,7 +120,7 @@ function wrapDraft(
120120
// The wrapper stands for its store proxy wherever the derive's result
121121
// carries it (`wrap`, `unwrapValue`, reconcile's slot matching).
122122
const t: StoreTarget | undefined = inner[$TARGET];
123-
if (t) (t.fam ? t.fam.map : storeLookup).set(px, t);
123+
if (t !== undefined) setLookup(px, t);
124124
return px;
125125
}
126126

‎packages/signals/src/store/store.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import {
9696
isOwned,
9797
lookupTarget,
9898
markDescendants,
99+
setLookup,
99100
storeLookup,
100101
storeOwners,
101102
type StoreFamily,
@@ -242,7 +243,7 @@ function createTarget(
242243
t.ovl = false;
243244
t.del = null;
244245
t.px = new Proxy(t, traps);
245-
(fam?.map ?? storeLookup).set(value, t);
246+
setLookup(value, t);
246247
if (__TEST__ && ingestedRaw && !isOwned(value)) ingestedRaw.add(value);
247248
return t;
248249
}
@@ -836,7 +837,7 @@ export function adoptPB(
836837
target.wk = null; // adoption supersedes staged trap writes
837838
const owner: StoreTarget | undefined = (incoming as any)[$OWNER];
838839
if (owner !== undefined && owner.fam === target.fam) (incoming as any)[$OWNER] = target;
839-
else (target.fam?.map ?? storeLookup).set(incoming, target);
840+
else setLookup(incoming, target);
840841
if (__TEST__ && ingestedRaw && !isOwned(incoming)) ingestedRaw.add(incoming);
841842
if (notify && base !== incoming) notifyFold(target, base, incoming);
842843
}

‎packages/signals/src/store/target.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ export const $OWNER: unique symbol = Symbol(__DEV__ ? "STORE_OWNER" : 0);
139139
* map so one raw can wrap once per family (§7b). */
140140
export const storeLookup = new WeakMap<object, StoreTarget>();
141141

142+
export function setLookup(raw: object, t: StoreTarget): void {
143+
(t.fam?.map ?? storeLookup).set(raw, t);
144+
}
145+
142146
export function isOwned(raw: object): boolean {
143147
return (raw as any)[$OWNER] !== undefined;
144148
}

‎scripts/size/floor-caps.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"app: render + one signal (the simple-app floor)": "9.86 KB",
44
"app: hydrating (no stores) with Show/For/Loading/Errored/lazy": "17.71 KB",
55
"page: base server components (hydrating + dynamic + frames + sf reference)": "44.84 KB",
6-
"page: live server components (base + live/GET + action + isPending/latest)": "48.53 KB",
6+
"page: live server components (base + live/GET + action + isPending/latest)": "48.51 KB",
77
"server: floor (getRequestEvent + isServer)": "1.34 KB",
88
"server: renderToString (the server-render floor)": "20.42 KB"
99
}

‎scripts/size/scenarios.js‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -887,14 +887,7 @@ module.exports = [
887887
// lane re-stage +13, verdict pull +1). Cap set at measured + 10 B rounded
888888
// up to 0.01 KB. Accepted by the maintainer (2026-10-05). The cap is
889889
// frozen again at 14.56 KB.
890-
// Size-Exception (#3767, 2026-10-05): 14.56 -> 14.58 KB, measured at
891-
// 14,565 B against `next` @ 01e80a601's 14,546 (+19 B; 5 B over the cap;
892-
// +63 B minified) — a projection draft wrapper registers as its store
893-
// target's alias, and `unwrapValue` resolves the alias (a retained draft
894-
// row adopted as its own backing recursed forever). Cap set at measured
895-
// + 10 B rounded up to 0.01 KB. Accepted by the maintainer (2026-10-05).
896-
// The cap is frozen again at 14.58 KB.
897-
limit: "14.58 KB",
890+
limit: "14.56 KB",
898891
alias
899892
},
900893
{
@@ -3429,13 +3422,6 @@ module.exports = [
34293422
// lane re-stage +13, verdict pull +1). Cap set at measured + 10 B rounded
34303423
// up to 0.01 KB. Accepted by the maintainer (2026-10-05). The cap is
34313424
// frozen again at 48.51 KB.
3432-
// Size-Exception (#3767, 2026-10-05): 48.51 -> 48.53 KB
3433-
// (floor-caps.json), measured at 48,514 B against `next` @ 01e80a601's
3434-
// 48,495 (+19 B; 4 B over the cap; +63 B minified) — the #3767 store
3435-
// alias (draft wrapper registration + `unwrapValue` alias check; see
3436-
// `signals: + createStore`). Cap set at measured + 10 B rounded up to
3437-
// 0.01 KB. Accepted by the maintainer (2026-10-05). The cap is frozen
3438-
// again at 48.53 KB.
34393425
limit: floorCaps["page: live server components (base + live/GET + action + isPending/latest)"],
34403426
alias: pageAlias
34413427
},

0 commit comments

Comments
 (0)