Skip to content

Commit 25a05b4

Browse files
committed
perf(signals): trim the #4536 hook: read the #4525 mark from the list view, no family stamp
The size job measured +230 B minified on the store-family row. The render-effect check reads the arrangement guess's own mark (`g` null on the list's view, as `_laneRebase` does) instead of stamping the flight's `_time` on the family, and `stands` checks the link in one pass over the derive's subscribers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
1 parent edc407f commit 25a05b4

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export function notifyOptimisticWrites(
195195
// older truth instead of folding beneath it (`_laneRebase`, F-1, #4525).
196196
const d = t._fam!.node;
197197
if (removed && d?._statusFlags! & STATUS_PENDING && !(d!._flags & REACTIVE_REASK))
198-
((view.g = null), (t._fam!.g = d!._time));
198+
view.g = null;
199199
optimisticWrite(getContainerNode(t), view as any);
200200
}
201201
if (t.dk !== null) optimisticWrite(t.dk, {} as any);
@@ -588,24 +588,22 @@ installOptHooks({
588588
// served the guess, a re-run (the guess's own, the seam) would drop its
589589
// link and release the hold beside a guess over the previous answer
590590
// (F-1, #4536) — the ordinary read serves its committed frame or keeps it
591-
// pending. So does a render effect pending on a flight the guess was
592-
// written over (`fam.g`, the #4525 mark; D-34: the guess does not answer
591+
// pending. So does a render effect pending on a flight a list guess was
592+
// written over (`g` null, the #4525 mark; D-34: the guess does not answer
593593
// it): read here, as `pullFamily`'s own read would, since the frame's
594594
// guard there returns early for an unlinked render effect.
595595
stands: t => {
596596
const f = t._fam!;
597597
const o = f._overlaid;
598598
const a = f._asked;
599-
if (!(o?.size && (a !== clock + 1 || passLane !== null || o.has(t)) && a !== ~clock))
600-
return false;
601-
const c: any = context;
602599
const d = f.node!;
603-
if (c === null) return true;
604-
for (let s = d._subs; s !== null; s = s._nextSub) if (s._sub === c) return false;
600+
const c: any = context;
601+
if (!o?.size || (a === clock + 1 && passLane === null && !o.has(t)) || a === ~clock)
602+
return false;
603+
for (let s = d._subs; s; s = s._nextSub) if (s._sub === c) return false;
605604
if (
606-
f.g === d._time &&
607-
c._type === EFFECT_RENDER &&
608-
c._statusFlags & STATUS_PENDING &&
605+
(t.k?._x?._lane as LaneView)?.g === null &&
606+
c?._type === EFFECT_RENDER &&
609607
c._x?._pendingSources?.has(d)
610608
)
611609
readNode(d);

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ export interface StoreFamily {
5353
* the committed value of (store.ts `pullFamily`, #4491): the derive's next
5454
* pass reads plainly (projection.ts). */
5555
w?: number;
56-
/** An arrangement guess was written while the derive asked a new question
57-
* (optimistic.ts, #4525): the derive's `_time` then, so the mark lapses
58-
* when the derive runs again (optimistic.ts `stands`, #4536). */
59-
g?: number;
6056
}
6157

6258
/** One setter's written keys; `u` is the batch's earlier setters' (the

0 commit comments

Comments
 (0)