Skip to content

Commit 4f8daa2

Browse files
ryansolidclaude
andauthored
fix(signals): a derived store row first read under a held adoption is paired with its old row (#3712) (#3986)
* fix(signals): a derived store row first read under a held adoption is paired with its old row (#3712) The adoption pairs old and new rows by key but can only record the pairing on a target, so a row nobody had read was never paired: its first read during the hold compared two raw objects, slot equality had nothing to go on, and the key was held — the independent write that read `cards.find(c => c.id === drag())?.id` was held for the action's lifetime. Pair the row at that read as applyAdopt would have (adoptChild): one target, the old raw its committed frame, the new raw its staging, held by the same transaction. Both raws resolve to it, so the slot reads as unchanged and the row's own leaves decide — id holds no one, version holds (A29). Arrays pair by the family's key (derived stores now record it, as optimistic ones do), records by key name; a reorder, a shallow family, or a reconcile() in a plain setter leaves the hold standing. sameRow is the one pairing predicate, shared with reconcile's aligned prefix. The #3707 defects (reorder aliasing, split proxy identity, a latest() child never cleared) are pinned. Size-Exception: + createStore 14.71 -> 14.85 KB, compiled CSR 25.465 -> 25.51 KB (+426 B minified each); core, isPending/latest, render and CSR unchanged. Accepted by the maintainer 2026-10-12. Fixes #3712 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ * fix(signals): keep swapped raws distinct when a held adoption pairs a row A held adoption that moves the same raw objects between slots ([A,B] -> [B,A], or a record's {x:A,y:B} -> {x:B,y:A}) paired A's target with B as staging on the first read, so after the commit both slots read B. A raw present in both frames is its own row: skip the pairing for it. The frame values are collected once per frame, so reading every row of a large adoption during the hold stays linear. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018LY7F9czoRqdMEvk2QwPr1 * chore(size): re-base the attribution scenario for #3994 and #3992 together Each fit its cap alone; landing together they took "CSR, observe tier + attribution engine enabled" to 28,942 B brotli / 87,216 B minified, 279 B past the recorded minified, which leaves `next`'s own size check red. This PR adds 0 B there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018LY7F9czoRqdMEvk2QwPr1 * fix(signals): share the swapped-raw rule between the eager and held pairings The rule that keeps a raw present in both frames its own row (#3712) lived only on the held first-read path (`adoptChild`); the eager `descend` paired the same record swap (`{x: A, y: B}` to `{x: B, y: A}`, both rows proxied) and aliased the two after the commit, held or not. One predicate, `ownRow`, now serves both. `descend` becomes a closure of `applyAdopt` so it reads the two frames without five call sites growing: +5 B brotli / +5 B minified on the createStore scenario over the previous commit. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015Q7JD9PktsxtBJJbWmtuwr * perf(signals): ask the swapped-raw rule only of a frame that carries a moved row Asked of every eager pair, the shared rule built a raw set per frame and CodSpeed measured -13% to -25% on the saturated reconcile benches. The eager pairing now decides once per frame whether any value is a row of the family already at a changed slot (`hasRow`: one lookup per value, no allocation); a frame of fresh raws, the common one, pairs by slot and builds nothing. A raw that is a row elsewhere keeps it, unless that row is the slot's own (its raw re-sent). Tests cover the one-row-proxied swap (the row follows its raw) and the immutable update kept at its slot (no move). +78 B brotli / +159 B minified on the createStore scenario over the PR's held-only form, recorded in the cap notes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015Q7JD9PktsxtBJJbWmtuwr * revert(signals): keep the swapped-raw rule on the held path only Reverts eae477f (the rule on every eager pair: -13% to -25% on the saturated reconcile benches) and d20ce53 (the rule behind a per-frame scan: +86 B brotli over this form on createStore). The PR returns to b7ece8c's form, +36 B over its first commit; the eager record swap that the reverted commits fixed is on `next` today and gets its own issue. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_015Q7JD9PktsxtBJJbWmtuwr --------- Co-authored-by: Claude <[email protected]>
1 parent 6232d18 commit 4f8daa2

10 files changed

Lines changed: 564 additions & 98 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
A derived store row first read during a held adoption is paired with its old row the way the adoption pairs rows (by the family's key), so reading a field the adoption left unchanged (`cards.find(...)?.id`) no longer holds an independent write for the action's lifetime (#3712). A changed field still holds.

‎packages/signals/docs/INTERNALS-STORE-STATE.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,20 @@ there is nothing to diff.)
182182
adoption's. A get/has/descriptor read of any other key is served from the
183183
backing to every reader and is not born holding. Keyless reads (`ownKeys`,
184184
`$TRACK`, `deep()`), chained backings, optimistic families and a swapped
185-
or non-plain prototype hold the whole container.
185+
or non-plain prototype hold the whole container. Below the key, the unit
186+
is the **leaf** (#3712): a row first read during the hold, which the
187+
adoption never paired because nothing had proxied it, is paired at that
188+
read as `applyAdopt` would have paired it (`adoptChild`: the family's key
189+
for an array row, the key name for a record's; `sameRow` is the one
190+
predicate both use) — one target, the old raw its committed frame, the
191+
new raw its staging, held by the same transaction — and its own leaves
192+
decide. Pairing at read time rather than at the adoption is the design,
193+
not a gap: nodes are lazy, the adoption records nothing, and a hold is the
194+
rare path, so what a hold asks is answered from the two backings when it
195+
is asked. Container → key → leaf is the end of this series; there is no
196+
finer unit. Not paired (the hold stands): a shallow family, a reorder (the
197+
keys differ), and a `reconcile()` in a plain setter, whose key the target
198+
does not carry.
186199

187200
## 4. Identity rules
188201

‎packages/signals/docs/RULES-INDEX.md‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
124124

125125
| id | status | defined | cited in src | cited in tests | statement (at definition) |
126126
|---|---|---|---|---|---|
127-
| RUL-1 | resolved | `docs/INTERNALS-STORE-STATE.md:521` | store.ts×2 | next-smoke.test.ts×1 | - **RUL-1 — RESOLVED (2026-08-16, verified per "mirror signals if verified" — |
128-
| RUL-2 | ruled | `docs/INTERNALS-STORE-STATE.md:530` | — | createOptimisticStore.test.ts×1 | - **RUL-2 — RULED (Ryan, 2026-08-17): no landing matrix. Two orthogonal |
129-
| RUL-3 | resolved | `docs/INTERNALS-STORE-STATE.md:629` | optimistic.ts×1 | — | - **RUL-3 — RESOLVED (verified 2026-08-16).** Ownership already lives |
130-
| RUL-4 | resolved | `docs/INTERNALS-STORE-STATE.md:636` | — | optimistic-signal-refetch-hold.test.ts×1 | - **RUL-4 — RESOLVED (2026-08-17, signal parity — verified empirically).** |
131-
| RUL-5 | live | `docs/INTERNALS-STORE-STATE.md:649` | — | adoption-lane-rollback.test.ts×1 | - **RUL-5 — SPEC'D (2026-08-17): §6b.** Lane backing + lane-view/committed- |
132-
| RUL-6 | live | `docs/INTERNALS-STORE-STATE.md:653` | — | — | - **RUL-6 — reclassified: SPEC WORK, not a ruling.** Live chaining (#2941 — |
133-
| RUL-7 | live | `docs/INTERNALS-STORE-STATE.md:662` | — | — | - **RUL-7 — SPEC'D (2026-08-17): §6c.** One status field on the root target, |
134-
| RUL-8 | live | `docs/INTERNALS-STORE-STATE.md:665` | — | adoption-lane-rollback.test.ts×1 | - **RUL-8 — SPEC'D (2026-08-17): §6 rewrite, resolves O2.** Per-transaction |
135-
| RUL-9 | resolved | `docs/INTERNALS-STORE-STATE.md:668` | — | — | - **RUL-9 — RESOLVED (2026-08-17, parity by construction).** Every piece of |
136-
| RUL-10 | live | `docs/INTERNALS-STORE-STATE.md:673` | — | — | - **RUL-10 — The equality trio.** One precise rule needed spanning: no-op |
137-
| RUL-11 | live | `docs/INTERNALS-STORE-STATE.md:679` | — | — | - **RUL-11 — SPEC'D (2026-08-17): §6d.** Sticky descendants flag ported from |
138-
| RUL-12 | live | `docs/INTERNALS-STORE-STATE.md:681` | store.ts×1 types.ts×1 | createProjection.async.test.ts×1 shared-child-multiparent.test.ts×1 | - **RUL-12 — Smaller rulings, each with a proposed default** (proceeding on |
139-
| RUL-13 | resolved | `docs/INTERNALS-STORE-STATE.md:727` | — | — | - **RUL-13 — RESOLVED (verified 2026-08-16)**: `optimistic-lane-transaction- |
127+
| RUL-1 | resolved | `docs/INTERNALS-STORE-STATE.md:534` | store.ts×2 | next-smoke.test.ts×1 | - **RUL-1 — RESOLVED (2026-08-16, verified per "mirror signals if verified" — |
128+
| RUL-2 | ruled | `docs/INTERNALS-STORE-STATE.md:543` | — | createOptimisticStore.test.ts×1 | - **RUL-2 — RULED (Ryan, 2026-08-17): no landing matrix. Two orthogonal |
129+
| RUL-3 | resolved | `docs/INTERNALS-STORE-STATE.md:642` | optimistic.ts×1 | — | - **RUL-3 — RESOLVED (verified 2026-08-16).** Ownership already lives |
130+
| RUL-4 | resolved | `docs/INTERNALS-STORE-STATE.md:649` | — | optimistic-signal-refetch-hold.test.ts×1 | - **RUL-4 — RESOLVED (2026-08-17, signal parity — verified empirically).** |
131+
| RUL-5 | live | `docs/INTERNALS-STORE-STATE.md:662` | — | adoption-lane-rollback.test.ts×1 | - **RUL-5 — SPEC'D (2026-08-17): §6b.** Lane backing + lane-view/committed- |
132+
| RUL-6 | live | `docs/INTERNALS-STORE-STATE.md:666` | — | — | - **RUL-6 — reclassified: SPEC WORK, not a ruling.** Live chaining (#2941 — |
133+
| RUL-7 | live | `docs/INTERNALS-STORE-STATE.md:675` | — | — | - **RUL-7 — SPEC'D (2026-08-17): §6c.** One status field on the root target, |
134+
| RUL-8 | live | `docs/INTERNALS-STORE-STATE.md:678` | — | adoption-lane-rollback.test.ts×1 | - **RUL-8 — SPEC'D (2026-08-17): §6 rewrite, resolves O2.** Per-transaction |
135+
| RUL-9 | resolved | `docs/INTERNALS-STORE-STATE.md:681` | — | — | - **RUL-9 — RESOLVED (2026-08-17, parity by construction).** Every piece of |
136+
| RUL-10 | live | `docs/INTERNALS-STORE-STATE.md:686` | — | — | - **RUL-10 — The equality trio.** One precise rule needed spanning: no-op |
137+
| RUL-11 | live | `docs/INTERNALS-STORE-STATE.md:692` | — | — | - **RUL-11 — SPEC'D (2026-08-17): §6d.** Sticky descendants flag ported from |
138+
| RUL-12 | live | `docs/INTERNALS-STORE-STATE.md:694` | store.ts×1 types.ts×1 | createProjection.async.test.ts×1 shared-child-multiparent.test.ts×1 | - **RUL-12 — Smaller rulings, each with a proposed default** (proceeding on |
139+
| RUL-13 | resolved | `docs/INTERNALS-STORE-STATE.md:740` | — | — | - **RUL-13 — RESOLVED (verified 2026-08-16)**: `optimistic-lane-transaction- |
140140
## R — core-store (`CS-R<n>`)
141141

142142
| id | status | defined | cited in src | cited in tests | statement (at definition) |
@@ -381,19 +381,19 @@ Status legend: **live** stated and standing · **ruled** carries an explicit rul
381381
| §1 | live | `docs/INTERNALS-STORE-STATE.md:27` | target.ts×1 | reveal-gating-contract.test.ts×1 | Storage model (the single-home rule) |
382382
| §2 | live | `docs/INTERNALS-STORE-STATE.md:81` | — | — | Read paths |
383383
| §3 | live | `docs/INTERNALS-STORE-STATE.md:116` | optimistic.ts×1 reconcile.ts×1 store.ts×2 | — | Write paths (all must stay equivalent) |
384-
| §4 | live | `docs/INTERNALS-STORE-STATE.md:187` | — | — | Identity rules |
385-
| §5 | live | `docs/INTERNALS-STORE-STATE.md:199` | store.ts×1 target.ts×1 | — | Laziness invariants (candidates for `__TEST__` assertions) |
386-
| §5b | live | `docs/INTERNALS-STORE-STATE.md:217` | target.ts×2 | — | Creation budget (phase-1 fitness) |
387-
| §5c | live | `docs/INTERNALS-STORE-STATE.md:236` | — | — | Comparison method (shipped vs rewrite) |
388-
| §6 | live | `docs/INTERNALS-STORE-STATE.md:287` | target.ts×1 | — | Structural edits — the key-set node (resolves O2, RUL-8) |
389-
| §6b | live | `docs/INTERNALS-STORE-STATE.md:315` | — | adoption-lane-rollback.test.ts×1 | Lane-aware adoption (RUL-5) |
390-
| §6c | live | `docs/INTERNALS-STORE-STATE.md:334` | — | createProjection.async.test.ts×1 flight-owned-transaction.test.ts×1 | Store-wide status gating (RUL-7) |
391-
| §6d | live | `docs/INTERNALS-STORE-STATE.md:347` | reconcile.ts×2 target.ts×2 | — | Diff reachability (RUL-11) |
392-
| §7 | live | `docs/INTERNALS-STORE-STATE.md:359` | optimistic.ts×1 projection.ts×1 | — | Projections & optimism layering |
393-
| §7b | live | `docs/INTERNALS-STORE-STATE.md:369` | scheduler.ts×1 affects.ts×1 optimistic.ts×2 projection.ts×1 reconcile.ts×1 store.ts×8 target.ts×4 | optimistic-chained-revert-3672-memo.test.ts×1 optimistic-removed-prop-3883.test.ts×1 | Chained backing (cross-store) — spec |
394-
| §8 | live | `docs/INTERNALS-STORE-STATE.md:440` | — | l2-contract.test.ts×1 reconcile-resend-identity.test.ts×1 | Assumptions / open questions |
395-
| §8b | live | `docs/INTERNALS-STORE-STATE.md:496` | — | — | Suite-mined rules (2026-08-16) — index & rulings needed |
396-
| §9 | live | `docs/INTERNALS-STORE-STATE.md:732` | — | — | Decision log |
384+
| §4 | live | `docs/INTERNALS-STORE-STATE.md:200` | — | — | Identity rules |
385+
| §5 | live | `docs/INTERNALS-STORE-STATE.md:212` | store.ts×1 target.ts×1 | — | Laziness invariants (candidates for `__TEST__` assertions) |
386+
| §5b | live | `docs/INTERNALS-STORE-STATE.md:230` | target.ts×2 | — | Creation budget (phase-1 fitness) |
387+
| §5c | live | `docs/INTERNALS-STORE-STATE.md:249` | — | — | Comparison method (shipped vs rewrite) |
388+
| §6 | live | `docs/INTERNALS-STORE-STATE.md:300` | target.ts×1 | — | Structural edits — the key-set node (resolves O2, RUL-8) |
389+
| §6b | live | `docs/INTERNALS-STORE-STATE.md:328` | — | adoption-lane-rollback.test.ts×1 | Lane-aware adoption (RUL-5) |
390+
| §6c | live | `docs/INTERNALS-STORE-STATE.md:347` | — | createProjection.async.test.ts×1 flight-owned-transaction.test.ts×1 | Store-wide status gating (RUL-7) |
391+
| §6d | live | `docs/INTERNALS-STORE-STATE.md:360` | reconcile.ts×2 target.ts×2 | — | Diff reachability (RUL-11) |
392+
| §7 | live | `docs/INTERNALS-STORE-STATE.md:372` | optimistic.ts×1 projection.ts×1 | — | Projections & optimism layering |
393+
| §7b | live | `docs/INTERNALS-STORE-STATE.md:382` | scheduler.ts×1 affects.ts×1 optimistic.ts×2 projection.ts×1 reconcile.ts×1 store.ts×8 target.ts×4 | optimistic-chained-revert-3672-memo.test.ts×1 optimistic-removed-prop-3883.test.ts×1 | Chained backing (cross-store) — spec |
394+
| §8 | live | `docs/INTERNALS-STORE-STATE.md:453` | — | l2-contract.test.ts×1 reconcile-resend-identity.test.ts×1 | Assumptions / open questions |
395+
| §8b | live | `docs/INTERNALS-STORE-STATE.md:509` | — | — | Suite-mined rules (2026-08-16) — index & rulings needed |
396+
| §9 | live | `docs/INTERNALS-STORE-STATE.md:745` | — | — | Decision log |
397397
| §11 | live | `docs/NODE-SHAPE.md:29` | — | — | Stage 3 opener: the core tax map (2026-08-21) |
398398
| §11b | live | `docs/NODE-SHAPE.md:53` | constants.ts×1 | rules-index.test.ts×1 treeshake.test.ts×1 | Presence bits — hot-path monomorphism |
399399
| §11c | live | `docs/NODE-SHAPE.md:72` | — | — | Stage-3 increment log |

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { nameStore, runDirect, storeSetter, wrap } from "./store.js";
3636
import { setLookup, type StoreFamily, type StoreTarget } from "./target.js";
3737
import {
3838
$TARGET,
39+
isWrappable,
3940
markRawIngest,
4041
setWriteOverride,
4142
type NoFn,
@@ -303,11 +304,20 @@ function createProjectionInternal<T extends object = {}>(
303304
seed: Partial<T>,
304305
options?: ProjectionOptions
305306
) {
307+
const keyOption = options?.key === undefined ? "id" : options.key;
306308
const fam: StoreFamily = {
307309
map: new WeakMap(),
308310
node: null,
309311
live: new Set(),
310-
shallow: !!options?.shallow
312+
shallow: !!options?.shallow,
313+
// The row key, for a child paired after the adoption (store.ts
314+
// `adoptChild`, #3712) as the adoption pairs them.
315+
key:
316+
typeof keyOption === "function"
317+
? keyOption
318+
: keyOption === null
319+
? null
320+
: (row: any) => (isWrappable(row) ? row[keyOption] : undefined)
311321
};
312322
const store = wrap(seed as any, null, null, fam) as Store<T>;
313323
if (fam.shallow) {
@@ -322,7 +332,7 @@ function createProjectionInternal<T extends object = {}>(
322332
}
323333
const node = computed(() => {
324334
if (!fam.node) fam.node = getOwner() as Computed<any>;
325-
runProjectionComputed(store, fn, options?.key === undefined ? "id" : options.key);
335+
runProjectionComputed(store, fn, keyOption);
326336
}, nodeOptions);
327337
node._config &= ~CONFIG_AUTO_DISPOSE;
328338
fam.node = node;

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
notifyKeyDiff,
3333
notifyKeyValue,
3434
sameKey,
35+
sameRow,
3536
targetsEqual,
3637
unwrapValue,
3738
userWriting
@@ -126,17 +127,7 @@ function applyAdopt(t: StoreTarget, incoming: any, keyFn: KeyFn | null, proj = f
126127
for (const end = Math.min(plen, nlen); i < end; i++) {
127128
const nv = nextRows[i];
128129
const pvRaw = prevRows[i];
129-
if (
130-
pvRaw !== nv &&
131-
!(
132-
pvRaw !== null &&
133-
typeof pvRaw === "object" &&
134-
nv !== null &&
135-
typeof nv === "object" &&
136-
sameKey(keyFn(pvRaw), keyFn(nv))
137-
)
138-
)
139-
break; // misaligned: fall to the keyed remainder below
130+
if (pvRaw !== nv && !sameRow(pvRaw, nv, keyFn)) break; // misaligned: fall to the keyed remainder below
140131
if (
141132
(pvRaw !== nv || (nv !== null && typeof nv === "object" && isOwned(nv))) &&
142133
nv !== null &&

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

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,70 @@ function readSource(
15861586
/** Did the HELD staging (the container node's, not a mainline layer above
15871587
* it) change `key`? */
15881588
function heldKeyChanged(target: StoreTarget, key: PropertyKey, shape = true): boolean {
1589-
return changedBetween(target, target.k!._value, target.k!._pendingValue, key, shape);
1589+
return (
1590+
changedBetween(target, target.k!._value, target.k!._pendingValue, key, shape) &&
1591+
!adoptChild(target, key)
1592+
);
1593+
}
1594+
1595+
/** The values of a held frame, built once per frame: neither the committed
1596+
* frame nor the held staging changes while the hold stands (a draft writes a
1597+
* clone), so the set stays true for every first read of the hold. */
1598+
const frameRaws = new WeakMap<object, Set<unknown>>();
1599+
function rawsOf(frame: object): Set<unknown> {
1600+
let raws = frameRaws.get(frame);
1601+
if (raws === undefined) frameRaws.set(frame, (raws = new Set(Object.values(frame))));
1602+
return raws;
1603+
}
1604+
1605+
/** The same row at a slot, as the adoption pairs rows (reconcile.ts): two
1606+
* objects whose keys agree — positionally for an unkeyed family. */
1607+
export function sameRow(pv: any, nv: any, keyFn: ((item: any) => any) | null): boolean {
1608+
return (
1609+
pv !== null &&
1610+
typeof pv === "object" &&
1611+
nv !== null &&
1612+
typeof nv === "object" &&
1613+
(keyFn === null || sameKey(keyFn(pv), keyFn(nv)))
1614+
);
1615+
}
1616+
1617+
/** A key of a held adoption whose old and new values are the same row that
1618+
* nothing had proxied when the adoption ran, so `descend` never paired
1619+
* them: paired now, as it would have been (#3712) — one target, the old
1620+
* raw its committed frame, the new raw its staging, held by the same
1621+
* transaction. Both raws resolve to it, so the slot reads as unchanged and
1622+
* the row's own leaves decide: `id` the same in both frames holds no one,
1623+
* `version` holds. A record's keys pair by name; an array's by the family's
1624+
* key — without a family the pairing is not known here and the hold stands. */
1625+
function adoptChild(target: StoreTarget, key: PropertyKey): boolean {
1626+
const k = target.k!;
1627+
const old = asBacking(k._value);
1628+
const ov = old[key as any];
1629+
const nv = (k._pendingValue as any)[key];
1630+
const keyFn = Array.isArray(old) ? target.fam?.key : null;
1631+
if (
1632+
target.s ||
1633+
keyFn === undefined ||
1634+
!sameRow(ov, nv, keyFn) ||
1635+
!isWrappable(ov) ||
1636+
!isWrappable(nv) ||
1637+
Array.isArray(ov) !== Array.isArray(nv) ||
1638+
lookupTarget(ov, target.fam) !== undefined ||
1639+
lookupTarget(nv, target.fam) !== undefined ||
1640+
// A raw in both frames (the same objects swapped or reordered) is its
1641+
// own row: pairing it with another would alias the two after the commit.
1642+
rawsOf(old).has(nv) ||
1643+
rawsOf(k._pendingValue as object).has(ov)
1644+
)
1645+
return false;
1646+
// A raw-marked value wraps to itself, a proxy to its own target: neither
1647+
// is a fresh target around `ov`.
1648+
const ct: StoreTarget | undefined = (wrap(ov, target, key) as any)[$TARGET];
1649+
if (ct === undefined || ct.v !== ov) return false;
1650+
adoptPB(ct, nv, false);
1651+
holdNode(getContainerNode(ct), txOf(k));
1652+
return true;
15901653
}
15911654

15921655
/** A family target's unheld staging, read with no pass (a handler). */

0 commit comments

Comments
 (0)