You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 500d484
Browse filesBrowse the repository at this point in the historyBrowse files
fix(signals): propagate affects() marks through derivation on the status rails
Rebuilds affects() as a sentinel pending-source that rides the same status
rails as real in-flight async: derived memos/effects read pending during the
mark's window while marked values stay readable, quiet refresh() re-asks
can't silence a declared window, and marks never block their own
transaction's settlement. Keyless store marks now cover captured child
proxies (<For> rows) by identity scope, with birth inheritance for nodes
created mid-window (#2882). Also narrows the API to affects(target, key?).
Co-authored-by: Cursor <[email protected]>
Rebuild `affects()` on the status rails so marks propagate through derivation (#2882). A live mark now pushes `STATUS_PENDING` downstream from the marked node exactly like real in-flight async — memos and effects DERIVED from marked data read pending too, not just direct reads of the marked slot — under a dedicated sentinel pending-source per marked node, so the two channels can't clear each other: a landing on the marked node settles only its own source entry, a quiet `refresh()` re-ask can't silence the declared window (the sentinel is never a re-ask), and a mark never blocks its own transaction's settlement (release happens AT settle). Computeds that recompute mid-window re-acquire the mark through the read path.
6
+
7
+
This also fixes keyless marks not covering captured store proxies (`<For>` rows): a keyless declaration walks the marked record's subtree (through write overlays), registers on every live node in it, snapshots the reachable raw identities, and nodes created during the window inherit the mark at birth from that scope. Records added after the declaration are not covered (snapshot-at-declaration semantics).
Narrow `affects()` to a single optional key: `affects(target, key?)`. The variadic form read like a 1.x store path (`affects(state, "user", "name")` suggests `state.user.name` but marked two sibling slots) — mark multiple slots with multiple calls, or target the nested record directly. Passing more than one key now throws in dev.
`refresh()` is also an action: call it from event handlers, effects, or other actions rather than from pure computations. It starts invalidation work; it does not carry user-visible optimistic state by itself. Because it re-asks the *same* question (no input changed), a bare `refresh()` is quiet: the fresh value reveals silently and `isPending` stays `false`. When the reload should read as pending, declare it with `affects()`.
78
78
79
-
### `affects(target, ...keys)` (declare what in-flight work will change)
79
+
### `affects(target, key?)` (declare what in-flight work will change)
80
80
81
-
`affects` declares that the surrounding work will change the targeted data. The named slots read as pending (`isPending` → `true`) from the declaration until the transaction settles or reverts. It is additive only: a declaration can turn pending *on* for data the graph can't see changing yet; nothing turns pending *off* while a real change is in flight.
81
+
`affects` declares that the surrounding work will change the targeted data. The marked data — and anything derived from it — reads as pending (`isPending` → `true`) from the declaration until the transaction settles or reverts, exactly as if a real fetch for it were in flight; the values themselves stay readable throughout. It is additive only: a declaration can turn pending *on* for data the graph can't see changing yet; nothing turns pending *off* while a real change is in flight — pairing `affects(x)` with `refresh(x)` keeps the whole window pending even though the bare refresh alone would be quiet.
82
82
83
-
Targets mirror how you read: `affects(store)` marks a store record (root or nested — siblings are untouched),`affects(record, "key")` marks exactly the named slots, and `affects(accessor)` marks a signal/memo source.
83
+
Targets mirror how you read: `affects(store)` marks a store record (root or nested) and everything reachable from it at declaration time — including rows captured by `<For>` — while siblings stay untouched;`affects(record, "key")` marks exactly the named slot; and `affects(accessor)` marks a signal/memo source. One key per call — keys do **not** form a path (mark several slots with several calls, or target the nested record directly).
Copy file name to clipboardExpand all lines: documentation/solid-2.0/MIGRATION.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -673,7 +673,7 @@ These APIs are new additions (not renames of 1.x APIs):
673
673
-**`isPending(fn)`** — expression-level "unrevealed change in flight" check.
674
674
-**`latest(fn)`** — peek at in-flight values during transitions.
675
675
-**`refresh(target)`** — explicit recomputation/invalidation of derived reads (a quiet re-ask — not pending).
676
-
-**`affects(target, ...keys)`** — declare that in-flight work will change the targeted data; the named slots read pending until the transaction settles.
676
+
-**`affects(target, key?)`** — declare that in-flight work will change the targeted data; the marked record (or the single named slot) reads pending until the transaction settles.
677
677
-**`resolve(fn)`** — returns a Promise that resolves when a reactive expression settles.
678
678
-**`Loading``on` prop** — controls when a Loading boundary re-shows fallback during revalidation.
679
679
-**`deep(store)`** — deep observation of a store (tracks all nested changes).
|`_pendingValue`| Transition-held next value; `NOT_PENDING` sentinel when absent (one meaning — a pending commit; revert targets were eliminated 2026-07-07b, §5e) |`setSignal` (non-optimistic), `recompute` (held branch), `asyncWrite` (override-active branch) |
20
20
|`_overrideValue`| Optimistic override; `undefined` = not an optimistic node, `NOT_PENDING` = resting optimistic node, else = active override |`setSignal` (optimistic branch), `recompute` (lane-corrected), `resolveOptimisticNodes` (clears to `NOT_PENDING`) |
21
-
|`_affectsCount`| Live `affects()` mark refcount: non-zero forces the node's verdict to `true` (declared motion, §5g). Carried by source nodes, store leaf nodes, and per-record `$AFFECTS` nodes |`registerAffectsMark` (+1, staged with the current transaction), `releaseAffectsMarks` (−1 at settle / flush end) |
21
+
|`_affectsCount`| Live `affects()` mark refcount: non-zero forces the node's verdict to `true` and propagates pending downstream via the node's sentinel (declared motion, §5g). Carried by source nodes, store leaf/track/has nodes, and per-record `$AFFECTS` carriers |`registerAffectsMark`/`markAffects` (+1, staged with the current transaction or a scope entry), `releaseAffectsMark` (−1 at settle / flush end; settles the sentinel when the count zeroes) |
22
+
|`_affectsSentinel`| The mark's identity on the pending-source rails (lazy): held in downstream `_pendingSources` like a real in-flight source, never a re-ask, never self-pending, branded with `_affectsFor` so settlement checks skip it |`getAffectsSentinel` (async.ts) |
22
23
|`_reask`| Question-scoped classification of the CURRENT pending window: `true` = the in-flight recompute is a re-ask of the same question (refresh with no input value change) — quiet, not pending (§5g). Meaningless while not `STATUS_PENDING`|`recompute` (from the `REACTIVE_REASK` flag), cleared by `clearStatus` and by value-change notifications (`insertSubs` clears the flag pre-recompute) |
0 commit comments