@solidjs/signals 2.0.0-rc.6 → 2.0.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +2033 -1291
- package/dist/node.cjs +1821 -2401
- package/dist/node.dev.cjs +13724 -0
- package/dist/prod/boundaries.js +3 -1
- package/dist/prod/core/async.js +6 -1
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +9 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +215 -139
- package/dist/prod/core/dev.js +2 -0
- package/dist/prod/core/effect.js +37 -28
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +35 -31
- package/dist/prod/core/heap.js +34 -40
- package/dist/prod/core/lanes.js +41 -27
- package/dist/prod/core/optimistic.js +42 -32
- package/dist/prod/core/owner.js +32 -32
- package/dist/prod/core/scheduler.js +140 -154
- package/dist/prod/core/verdict.js +31 -34
- package/dist/prod/index.js +0 -2
- package/dist/prod/map.js +104 -94
- package/dist/prod/signals.js +51 -34
- package/dist/prod/store/next/optimistic.js +153 -172
- package/dist/prod/store/next/reconcile.js +140 -288
- package/dist/prod/store/next/store.js +307 -237
- package/dist/prod/store/store.js +2 -2
- package/dist/types/core/attribution-hooks.d.ts +64 -0
- package/dist/types/core/attribution.d.ts +265 -9
- package/dist/types/core/constants.d.ts +8 -0
- package/dist/types/core/core.d.ts +12 -3
- package/dist/types/core/dev.d.ts +49 -8
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +10 -0
- package/dist/types/core/scheduler.d.ts +9 -4
- package/dist/types/signals.d.ts +10 -0
- package/dist/types/store/index.d.ts +3 -6
- package/dist/types/store/next/optimistic.d.ts +4 -2
- package/dist/types/store/next/reconcile.d.ts +5 -12
- package/dist/types/store/next/store.d.ts +3 -9
- package/dist/types/store/next/target.d.ts +20 -46
- package/dist/types/store/store.d.ts +14 -9
- package/dist/types-cjs/core/attribution-hooks.d.cts +64 -0
- package/dist/types-cjs/core/attribution.d.cts +265 -9
- package/dist/types-cjs/core/constants.d.cts +8 -0
- package/dist/types-cjs/core/core.d.cts +12 -3
- package/dist/types-cjs/core/dev.d.cts +49 -8
- package/dist/types-cjs/core/heap.d.cts +5 -3
- package/dist/types-cjs/core/invariants.d.cts +1 -1
- package/dist/types-cjs/core/lanes.d.cts +10 -0
- package/dist/types-cjs/core/scheduler.d.cts +9 -4
- package/dist/types-cjs/signals.d.cts +10 -0
- package/dist/types-cjs/store/index.d.cts +3 -6
- package/dist/types-cjs/store/next/optimistic.d.cts +4 -2
- package/dist/types-cjs/store/next/reconcile.d.cts +5 -12
- package/dist/types-cjs/store/next/store.d.cts +3 -9
- package/dist/types-cjs/store/next/target.d.cts +20 -46
- package/dist/types-cjs/store/store.d.cts +14 -9
- package/package.json +3 -2
- package/dist/prod/store/next/patch-hooks.js +0 -13
- package/dist/prod/store/next/patch.js +0 -614
- package/dist/types/store/next/patch-hooks.d.ts +0 -41
- package/dist/types/store/next/patch.d.ts +0 -91
- package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
- package/dist/types-cjs/store/next/patch.d.cts +0 -91
package/dist/prod/core/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { releaseFlightTeardown, handleAsync, clearStatus, parkLoadingWindow, notifyStatus, settlePendingSource, settleErroredDependents } from "./async.js";
|
|
2
2
|
|
|
3
|
-
import { EFFECT_TRACKED, REACTIVE_OPTIMISTIC_DIRTY, CONFIG_OPTIMISTIC, NOT_PENDING, STATUS_UNINITIALIZED, STATUS_ERROR, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, CONFIG_SYNC, CONFIG_HAS_LANE, STATUS_PENDING, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_SNAPSHOT_STALE, unwrapOverride, CONFIG_DIRECT_COMMIT, OVERRIDE_UNDEFINED, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_HAS_COMPANIONS, REACTIVE_LAZY, REACTIVE_DISPOSED, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_FRESH_READ, CONFIG_AUTHORITATIVE_READ, CONFIG_HELD_TRUTH, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, defaultContext, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_TRANSPARENT, CONFIG_OWNED_WRITE, CONFIG_NO_SNAPSHOT, CONFIG_FW_CHILDREN, NO_SNAPSHOT, CONFIG_HAS_SNAPSHOT, REACTIVE_MANUAL_WRITE,
|
|
3
|
+
import { EFFECT_TRACKED, EFFECT_USER, REACTIVE_OPTIMISTIC_DIRTY, CONFIG_OPTIMISTIC, NOT_PENDING, STATUS_UNINITIALIZED, STATUS_ERROR, REACTIVE_REASK, REACTIVE_RECOMPUTING_DEPS, CONFIG_SYNC, CONFIG_HAS_LANE, STATUS_PENDING, REACTIVE_MISSED_WAKE, REACTIVE_NONE, REACTIVE_SNAPSHOT_STALE, unwrapOverride, CONFIG_DIRECT_COMMIT, OVERRIDE_UNDEFINED, CONFIG_AUTHORITATIVE_OBSERVED, CONFIG_HAS_COMPANIONS, REACTIVE_LAZY, REACTIVE_DISPOSED, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, CONFIG_FRESH_READ, CONFIG_AUTHORITATIVE_READ, CONFIG_HELD_TRUTH, REACTIVE_CHECK, REACTIVE_DIRTY, REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, defaultContext, CONFIG_IN_SNAPSHOT_SCOPE, CONFIG_TRANSPARENT, CONFIG_OWNED_WRITE, CONFIG_NO_SNAPSHOT, CONFIG_FW_CHILDREN, NO_SNAPSHOT, CONFIG_HAS_SNAPSHOT, REACTIVE_MANUAL_WRITE, CONFIG_SLOT_NODE, STORE_SNAPSHOT_PROPS } from "./constants.js";
|
|
4
4
|
|
|
5
5
|
import { NotReadyError } from "./error.js";
|
|
6
6
|
|
|
@@ -14,9 +14,23 @@ import "./invariants.js";
|
|
|
14
14
|
|
|
15
15
|
import { disposeChildren, markDisposal, inheritId } from "./owner.js";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// The heap's per-node step. A tracked effect's heap visit is its compute
|
|
18
|
+
// phase — empty, like a user effect whose compute reads nothing — and hands
|
|
19
|
+
// the callback to the user queue. Routing the wake through the heap, rather
|
|
20
|
+
// than straight into the queue at notify time, is what orders the run after
|
|
21
|
+
// the commit regardless of which phase the write came from: a write in a
|
|
22
|
+
// render-effect callback stages its value for the next pass, but a wake pushed
|
|
23
|
+
// directly into the user queue ran in the SAME pass, read the old value, and
|
|
24
|
+
// nothing re-notified it when the value landed (#3291).
|
|
25
|
+
GlobalQueue.Fe = e => {
|
|
26
|
+
if (e.ge === EFFECT_TRACKED) {
|
|
27
|
+
deleteFromHeap(e, queueFor(e));
|
|
28
|
+
e.He = true;
|
|
29
|
+
e.C.enqueue(EFFECT_USER, e.Ve);
|
|
30
|
+
} else recompute(e);
|
|
31
|
+
};
|
|
18
32
|
|
|
19
|
-
GlobalQueue.
|
|
33
|
+
GlobalQueue.ke = disposeChildren;
|
|
20
34
|
|
|
21
35
|
let tracking = false;
|
|
22
36
|
|
|
@@ -48,8 +62,8 @@ let snapshotSources = null;
|
|
|
48
62
|
|
|
49
63
|
function ownerInSnapshotScope(e) {
|
|
50
64
|
while (e) {
|
|
51
|
-
if (e.
|
|
52
|
-
e = e.
|
|
65
|
+
if (e.xe) return true;
|
|
66
|
+
e = e.Le;
|
|
53
67
|
}
|
|
54
68
|
return false;
|
|
55
69
|
}
|
|
@@ -60,20 +74,20 @@ function setSnapshotCapture(e) {
|
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
function markSnapshotScope(e) {
|
|
63
|
-
e.
|
|
77
|
+
e.xe = true;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
function releaseSnapshotScope(e) {
|
|
67
|
-
e.
|
|
81
|
+
e.xe = false;
|
|
68
82
|
releaseSubtree(e);
|
|
69
83
|
schedule();
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
function releaseSubtree(e) {
|
|
73
|
-
let t = e.
|
|
87
|
+
let t = e.Qe;
|
|
74
88
|
while (t) {
|
|
75
|
-
if (t.
|
|
76
|
-
t = t.
|
|
89
|
+
if (t.xe) {
|
|
90
|
+
t = t.We;
|
|
77
91
|
continue;
|
|
78
92
|
}
|
|
79
93
|
if (t.oe) {
|
|
@@ -82,19 +96,19 @@ function releaseSubtree(e) {
|
|
|
82
96
|
if (e.ie & REACTIVE_SNAPSHOT_STALE) {
|
|
83
97
|
e.ie &= ~REACTIVE_SNAPSHOT_STALE;
|
|
84
98
|
e.ie |= REACTIVE_DIRTY;
|
|
85
|
-
if (dirtyQueue.
|
|
99
|
+
if (dirtyQueue.Me > e.qe) dirtyQueue.Me = e.qe;
|
|
86
100
|
insertIntoHeap(e, dirtyQueue);
|
|
87
101
|
}
|
|
88
102
|
}
|
|
89
103
|
releaseSubtree(t);
|
|
90
|
-
t = t.
|
|
104
|
+
t = t.We;
|
|
91
105
|
}
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
function clearSnapshots() {
|
|
95
109
|
if (snapshotSources) {
|
|
96
110
|
for (const e of snapshotSources) {
|
|
97
|
-
delete e.o?.
|
|
111
|
+
delete e.o?.Ye;
|
|
98
112
|
// StoreNode targets share one pre-initialized hidden class (see
|
|
99
113
|
// createStoreProxy) — assign undefined instead of deleting, and only
|
|
100
114
|
// when present so signal-node sources don't grow the field.
|
|
@@ -122,14 +136,14 @@ function recompute(e, t = false) {
|
|
|
122
136
|
releaseFlightTeardown(e);
|
|
123
137
|
}
|
|
124
138
|
// Tracked effects run after finalizePureQueue, so dispose immediately instead of deferring
|
|
125
|
-
if (e.Ae || n === EFFECT_TRACKED) disposeChildren(e); else if (e.
|
|
139
|
+
if (e.Ae || n === EFFECT_TRACKED) disposeChildren(e); else if (e.Qe !== null || e.Ge !== null) {
|
|
126
140
|
markDisposal(e);
|
|
127
141
|
const t = ext(e);
|
|
128
|
-
t.
|
|
129
|
-
t.
|
|
142
|
+
t.Ze = e.Ge;
|
|
143
|
+
t.Ke = e.Qe;
|
|
130
144
|
e.Ge = null;
|
|
131
|
-
e.
|
|
132
|
-
e.
|
|
145
|
+
e.Qe = null;
|
|
146
|
+
e.je = 0;
|
|
133
147
|
} else ;
|
|
134
148
|
}
|
|
135
149
|
let i = !!(e.ie & REACTIVE_OPTIMISTIC_DIRTY);
|
|
@@ -154,14 +168,14 @@ function recompute(e, t = false) {
|
|
|
154
168
|
// commits (commitPendingNode) — a closed window plus a held value reads as
|
|
155
169
|
// a pending frame to live observers of the verdict (#2990).
|
|
156
170
|
const r = e.Ne;
|
|
157
|
-
const
|
|
171
|
+
const _ = context;
|
|
158
172
|
context = e;
|
|
159
|
-
e.
|
|
160
|
-
e.
|
|
173
|
+
e.Be = null;
|
|
174
|
+
e.ze++;
|
|
161
175
|
e.ie = REACTIVE_RECOMPUTING_DEPS;
|
|
162
176
|
e.Te = clock;
|
|
163
|
-
let
|
|
164
|
-
let f = e.
|
|
177
|
+
let c = e.Re === NOT_PENDING ? e.be : e.Re;
|
|
178
|
+
let f = e.qe;
|
|
165
179
|
let I = false;
|
|
166
180
|
let E = tracking;
|
|
167
181
|
let N = currentOptimisticLane;
|
|
@@ -178,17 +192,17 @@ function recompute(e, t = false) {
|
|
|
178
192
|
// engine-driven paths, and _optimisticNodes is only pushed by
|
|
179
193
|
// _optimisticWrite, so the hook is installed whenever either gate holds.
|
|
180
194
|
if (i) {
|
|
181
|
-
const t = GlobalQueue.
|
|
195
|
+
const t = GlobalQueue.Je(e, true);
|
|
182
196
|
if (t) currentOptimisticLane = t;
|
|
183
197
|
// `false` = wake-only lane demotion: recompute plain so a mid-tick
|
|
184
198
|
// latest()/isPending() pull stages instead of direct-committing (#3009).
|
|
185
199
|
// The predicate lives with the engine (recomputeLane).
|
|
186
200
|
else if (t === false) i = false;
|
|
187
|
-
} else if (activeTransition && !t && activeTransition.
|
|
201
|
+
} else if (activeTransition && !t && activeTransition.Xe.length) {
|
|
188
202
|
// Lane adoption: parent-deeper-than-owned-child can run before its OPT-dirty
|
|
189
203
|
// child propagates. Walk deps once and inherit the OPT lane so this node
|
|
190
204
|
// recomputes under the right posture and propagates correctly.
|
|
191
|
-
const t = GlobalQueue.
|
|
205
|
+
const t = GlobalQueue.Je(e, false);
|
|
192
206
|
if (t) {
|
|
193
207
|
i = true;
|
|
194
208
|
currentOptimisticLane = t;
|
|
@@ -199,7 +213,7 @@ function recompute(e, t = false) {
|
|
|
199
213
|
if (S) stale = true;
|
|
200
214
|
try {
|
|
201
215
|
if (!false && e.T & CONFIG_SYNC) {
|
|
202
|
-
|
|
216
|
+
c = e.oe(c);
|
|
203
217
|
if (e.o !== null) e.o.Ie = null;
|
|
204
218
|
e.Ne = false;
|
|
205
219
|
} else {
|
|
@@ -209,10 +223,10 @@ function recompute(e, t = false) {
|
|
|
209
223
|
// clobber the fresh subscription, so we skip it and let the internally-registered
|
|
210
224
|
// iteration drive updates.
|
|
211
225
|
const t = e.o?.Ie;
|
|
212
|
-
const n = e.oe(
|
|
226
|
+
const n = e.oe(c);
|
|
213
227
|
const i = typeof n === "object" && n !== null;
|
|
214
228
|
const u = e.o?.Ie !== t;
|
|
215
|
-
|
|
229
|
+
c = u || !i ? n : handleAsync(e, n);
|
|
216
230
|
if (!u && !i) {
|
|
217
231
|
if (e.o !== null) e.o.Ie = null;
|
|
218
232
|
// A sync (non-object) return is the first real answer; async-shaped
|
|
@@ -229,7 +243,7 @@ function recompute(e, t = false) {
|
|
|
229
243
|
if (e.S !== 0 || e.o !== null) clearStatus(e, t);
|
|
230
244
|
// _optimisticLane is only ever assigned by engine paths (CONFIG_HAS_LANE
|
|
231
245
|
// is their sticky presence mark).
|
|
232
|
-
if (e.T & CONFIG_HAS_LANE && e.o
|
|
246
|
+
if (e.T & CONFIG_HAS_LANE && e.o?.$e) GlobalQueue.et(e);
|
|
233
247
|
} catch (t) {
|
|
234
248
|
const n = t instanceof NotReadyError;
|
|
235
249
|
if (n && e.Ne) {
|
|
@@ -244,13 +258,13 @@ function recompute(e, t = false) {
|
|
|
244
258
|
} else {
|
|
245
259
|
// Track pending async in the lane (not the lane's source — it creates the lane
|
|
246
260
|
// but doesn't belong to it). Set lane BEFORE notifyStatus for downstream propagation.
|
|
247
|
-
if (n && currentOptimisticLane) GlobalQueue
|
|
261
|
+
if (n && currentOptimisticLane) GlobalQueue.tt(e);
|
|
248
262
|
let i = false;
|
|
249
263
|
if (n) {
|
|
250
264
|
ext(e).fe = true;
|
|
251
|
-
if (GlobalQueue.
|
|
265
|
+
if (GlobalQueue.nt !== null) i = GlobalQueue.nt(e, a);
|
|
252
266
|
}
|
|
253
|
-
notifyStatus(e, n ? STATUS_PENDING : STATUS_ERROR, t, undefined, n ? e.o
|
|
267
|
+
notifyStatus(e, n ? STATUS_PENDING : STATUS_ERROR, t, undefined, n ? e.o?.$e : undefined);
|
|
254
268
|
// The replacement source is fully propagated now. If no new flight
|
|
255
269
|
// re-owned self, retire the superseded flight and its dependent copies.
|
|
256
270
|
if (n && s && !e.o?.Ie) settlePendingSource(e);
|
|
@@ -267,14 +281,14 @@ function recompute(e, t = false) {
|
|
|
267
281
|
// bookkeeping, and those marks are correctly discarded here.
|
|
268
282
|
I = (e.ie & REACTIVE_MISSED_WAKE) !== 0;
|
|
269
283
|
e.ie = REACTIVE_NONE | (t ? e.ie & REACTIVE_SNAPSHOT_STALE : 0);
|
|
270
|
-
context =
|
|
284
|
+
context = _;
|
|
271
285
|
}
|
|
272
286
|
if (!e.o?._) {
|
|
273
287
|
trimStaleDeps(e);
|
|
274
288
|
const a = u ? unwrapOverride(e.o?.Pe) : e.Re === NOT_PENDING ? e.be : e.Re;
|
|
275
|
-
let
|
|
289
|
+
let _ = false;
|
|
276
290
|
try {
|
|
277
|
-
|
|
291
|
+
_ = !n && l || !e.pe || !e.pe(a, c);
|
|
278
292
|
} catch (t) {
|
|
279
293
|
// A throwing user comparator is an error of this node's computation.
|
|
280
294
|
// Route it through the same status path as a compute-phase throw so
|
|
@@ -287,13 +301,13 @@ function recompute(e, t = false) {
|
|
|
287
301
|
// its runner — happen here instead. `!create` matches the previous `initialized`
|
|
288
302
|
// gate: the explicit recompute(node, true) inside effect() does not enqueue, so
|
|
289
303
|
// effect() can call its runner synchronously for the first run.
|
|
290
|
-
if (n &&
|
|
291
|
-
e.
|
|
304
|
+
if (n && _) {
|
|
305
|
+
e.He = !e.o?._;
|
|
292
306
|
// Reuse one bound runner per effect — runEffect no-ops on a stale
|
|
293
307
|
// `_modified`, so re-enqueueing the same function is harmless.
|
|
294
|
-
if (!t) e.C.enqueue(n, e.
|
|
308
|
+
if (!t) e.C.enqueue(n, e.it ??= GlobalQueue.ut.bind(null, e));
|
|
295
309
|
}
|
|
296
|
-
if (e.o?._) ; else if (
|
|
310
|
+
if (e.o?._) ; else if (_) {
|
|
297
311
|
const l = u ? e.o?.Pe : undefined;
|
|
298
312
|
if (t ||
|
|
299
313
|
// Plain sync flush (no transition on either side) commits effect
|
|
@@ -305,17 +319,17 @@ function recompute(e, t = false) {
|
|
|
305
319
|
// not the stashed queues, so a staged value would hand the immediate
|
|
306
320
|
// apply stale state — see CONFIG_DIRECT_COMMIT.
|
|
307
321
|
n && (activeTransition !== e.Ae || activeTransition === null || e.T & CONFIG_DIRECT_COMMIT) || i) {
|
|
308
|
-
e.be =
|
|
322
|
+
e.be = c;
|
|
309
323
|
// Lane-propagated correction: upstream data is fresh, correct the
|
|
310
324
|
// override unconditionally. The direct _value commit is the lane's
|
|
311
325
|
// own reveal schedule; drop any superseded older hold so its queued
|
|
312
326
|
// commit can't clobber the fresh value.
|
|
313
327
|
if (u && i) {
|
|
314
|
-
ext(e).Pe =
|
|
328
|
+
ext(e).Pe = c === undefined ? OVERRIDE_UNDEFINED : c;
|
|
315
329
|
e.Re = NOT_PENDING;
|
|
316
330
|
}
|
|
317
331
|
} else {
|
|
318
|
-
e.Re =
|
|
332
|
+
e.Re = c;
|
|
319
333
|
// A window landing that gets held re-opens the window until the hold
|
|
320
334
|
// commits — the verdict's held-value branch is window-gated (#2990).
|
|
321
335
|
if (r) e.Ne = true;
|
|
@@ -324,7 +338,7 @@ function recompute(e, t = false) {
|
|
|
324
338
|
// (#2831). Both companion writes are transition-scoped (optimistic) and
|
|
325
339
|
// auto-revert/re-derive at commit. Skipped for plain flushes where the
|
|
326
340
|
// pending value commits before effects run.
|
|
327
|
-
if ((activeTransition || e.Ae) && GlobalQueue.Ue !== null) GlobalQueue.Ue(e,
|
|
341
|
+
if ((activeTransition || e.Ae) && GlobalQueue.Ue !== null) GlobalQueue.Ue(e, c);
|
|
328
342
|
}
|
|
329
343
|
// insertSubs only walks _subs (no scheduling of its own), so a
|
|
330
344
|
// subscriber-less node has nothing to notify.
|
|
@@ -334,16 +348,16 @@ function recompute(e, t = false) {
|
|
|
334
348
|
// is active: _value may still be stale, so hold the authoritative value
|
|
335
349
|
// for commit on its own transition's schedule — invisibly (A17/A18).
|
|
336
350
|
if (e.Re === NOT_PENDING) queuePendingNode(e);
|
|
337
|
-
e.Re =
|
|
351
|
+
e.Re = c;
|
|
338
352
|
if (r) e.Ne = true;
|
|
339
353
|
// see the held branch above (#2990)
|
|
340
|
-
//
|
|
341
|
-
// override — and "authoritative arrival
|
|
342
|
-
// exactly the acknowledgment it waits for.
|
|
343
|
-
// A17 silence holds for every ordinary
|
|
344
|
-
//
|
|
354
|
+
// An authoritative-view reader (until()'s predicate, refresh()'s waiter)
|
|
355
|
+
// observed this node past its override — and "authoritative arrival
|
|
356
|
+
// equal to the override" is exactly the acknowledgment it waits for.
|
|
357
|
+
// Wake those readers only; A17 silence holds for every ordinary
|
|
358
|
+
// subscriber. (Hook installed by both setters of the gating bit, #3303.)
|
|
345
359
|
if (e.T & CONFIG_AUTHORITATIVE_OBSERVED) GlobalQueue.he(e);
|
|
346
|
-
} else if (e.
|
|
360
|
+
} else if (e.qe != f) {
|
|
347
361
|
for (let t = e.u; t !== null; t = t.ae) {
|
|
348
362
|
insertIntoHeapHeight(t.ce, queueFor(t.ce));
|
|
349
363
|
}
|
|
@@ -353,14 +367,14 @@ function recompute(e, t = false) {
|
|
|
353
367
|
// in an errored run and may sit on stale commits (#2949). Changed-value
|
|
354
368
|
// recoveries ride insertSubs above; a comparator throw re-errored the node
|
|
355
369
|
// (el._x?._error re-set), so this only runs on a genuinely clean recovery.
|
|
356
|
-
if (o !== undefined && !
|
|
370
|
+
if (o !== undefined && !_ && !e.o?._) settleErroredDependents(e, o);
|
|
357
371
|
// #3181: a synchronous settle supersedes the old landing callback, so
|
|
358
372
|
// recompute owns its pending-source sweep. An uninitialized node without
|
|
359
373
|
// a replacement source still has no truth to reveal and must stay parked.
|
|
360
374
|
if (s && !(e.S & (STATUS_PENDING | STATUS_UNINITIALIZED))) settlePendingSource(e);
|
|
361
375
|
}
|
|
362
376
|
currentOptimisticLane = N;
|
|
363
|
-
const A = e.Re !== NOT_PENDING || e.o !== null && (e.o.
|
|
377
|
+
const A = e.Re !== NOT_PENDING || e.o !== null && (e.o.Ke !== null || e.o.Ze !== null) || (e.S & (STATUS_PENDING | STATUS_UNINITIALIZED)) !== 0;
|
|
364
378
|
// Override-covered holds (hasOverride) always queue: their commit belongs
|
|
365
379
|
// to their own transition's schedule (A18 re-rule) and is unobservable
|
|
366
380
|
// under the override (A17). Revert no longer commits anything, so an
|
|
@@ -388,9 +402,9 @@ function updateIfNecessary(e) {
|
|
|
388
402
|
// would resurrect it (#2983) — readers serve its last value.
|
|
389
403
|
if (e.ie & (REACTIVE_RECOMPUTING_DEPS | REACTIVE_DISPOSED)) return;
|
|
390
404
|
if (e.ie & REACTIVE_CHECK) {
|
|
391
|
-
for (let t = e.
|
|
392
|
-
const n = t.
|
|
393
|
-
const i = n.
|
|
405
|
+
for (let t = e.lt; t; t = t.ot) {
|
|
406
|
+
const n = t.st;
|
|
407
|
+
const i = n.rt || n;
|
|
394
408
|
if (i.oe) {
|
|
395
409
|
updateIfNecessary(i);
|
|
396
410
|
}
|
|
@@ -418,28 +432,28 @@ function computed(e, t) {
|
|
|
418
432
|
Ge: null,
|
|
419
433
|
C: context?.C ?? globalQueue,
|
|
420
434
|
we: context?.we ?? defaultContext,
|
|
421
|
-
|
|
435
|
+
je: 0,
|
|
422
436
|
oe: e,
|
|
423
437
|
be: i ? t.loadingValue : undefined,
|
|
424
|
-
|
|
425
|
-
|
|
438
|
+
qe: 0,
|
|
439
|
+
_t: undefined,
|
|
426
440
|
ct: null,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
441
|
+
lt: null,
|
|
442
|
+
Be: null,
|
|
443
|
+
ze: 0,
|
|
430
444
|
u: null,
|
|
431
|
-
_t: null,
|
|
432
|
-
ke: context,
|
|
433
|
-
Le: null,
|
|
434
445
|
ft: null,
|
|
435
|
-
|
|
446
|
+
Le: context,
|
|
447
|
+
We: null,
|
|
448
|
+
It: null,
|
|
449
|
+
Qe: null,
|
|
436
450
|
ie: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
437
451
|
// A loadingValue node is born committed: commit #0 is already in _value.
|
|
438
452
|
S: i ? 0 : STATUS_UNINITIALIZED,
|
|
439
453
|
Te: clock,
|
|
440
454
|
Re: NOT_PENDING,
|
|
441
455
|
Ae: null,
|
|
442
|
-
|
|
456
|
+
Et: -1,
|
|
443
457
|
Ne: i,
|
|
444
458
|
// Cold machinery (async/transition/optimistic/verdict slots) lives one
|
|
445
459
|
// hop away in the lazily-allocated extension — the core literal MUST
|
|
@@ -447,7 +461,7 @@ function computed(e, t) {
|
|
|
447
461
|
// allocation spills to a backing store and creation cost ~4x's).
|
|
448
462
|
o: null
|
|
449
463
|
};
|
|
450
|
-
if (t?.unobserved) ext(u).
|
|
464
|
+
if (t?.unobserved) ext(u).Nt = t.unobserved;
|
|
451
465
|
setupComputedNode(u, t);
|
|
452
466
|
return u;
|
|
453
467
|
}
|
|
@@ -458,11 +472,11 @@ function computed(e, t) {
|
|
|
458
472
|
* Never call ext() just to store a field's default. */ function ext(e) {
|
|
459
473
|
return e.o ??= {
|
|
460
474
|
Pe: undefined,
|
|
461
|
-
|
|
462
|
-
|
|
475
|
+
Tt: undefined,
|
|
476
|
+
$e: undefined,
|
|
463
477
|
ye: undefined,
|
|
464
478
|
Ce: undefined,
|
|
465
|
-
|
|
479
|
+
St: undefined,
|
|
466
480
|
t: 0,
|
|
467
481
|
Ie: null,
|
|
468
482
|
Ee: null,
|
|
@@ -472,11 +486,11 @@ function computed(e, t) {
|
|
|
472
486
|
h: undefined,
|
|
473
487
|
De: false,
|
|
474
488
|
i: null,
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
489
|
+
Nt: undefined,
|
|
490
|
+
Ye: undefined,
|
|
491
|
+
Ze: null,
|
|
492
|
+
Ke: null,
|
|
493
|
+
dt: undefined
|
|
480
494
|
};
|
|
481
495
|
}
|
|
482
496
|
|
|
@@ -489,38 +503,38 @@ function computed(e, t) {
|
|
|
489
503
|
const l = u?.transparent ?? false;
|
|
490
504
|
const o = {
|
|
491
505
|
id: inheritId(u, l, context),
|
|
492
|
-
T: (l ? CONFIG_TRANSPARENT : 0) | (u?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (u?.sync ? CONFIG_SYNC : 0) | (u?.
|
|
506
|
+
T: (l ? CONFIG_TRANSPARENT : 0) | (u?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (u?.sync ? CONFIG_SYNC : 0) | (u?.At ?? 0) | (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
493
507
|
pe: false,
|
|
494
508
|
Ge: null,
|
|
495
509
|
C: context?.C ?? globalQueue,
|
|
496
510
|
we: context?.we ?? defaultContext,
|
|
497
|
-
|
|
511
|
+
je: 0,
|
|
498
512
|
oe: e,
|
|
499
513
|
be: undefined,
|
|
500
|
-
|
|
501
|
-
|
|
514
|
+
qe: 0,
|
|
515
|
+
_t: undefined,
|
|
502
516
|
ct: null,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
517
|
+
lt: null,
|
|
518
|
+
Be: null,
|
|
519
|
+
ze: 0,
|
|
506
520
|
u: null,
|
|
507
|
-
_t: null,
|
|
508
|
-
ke: context,
|
|
509
|
-
Le: null,
|
|
510
521
|
ft: null,
|
|
511
|
-
|
|
522
|
+
Le: context,
|
|
523
|
+
We: null,
|
|
524
|
+
It: null,
|
|
525
|
+
Qe: null,
|
|
512
526
|
ie: REACTIVE_LAZY,
|
|
513
527
|
S: STATUS_UNINITIALIZED,
|
|
514
528
|
Te: clock,
|
|
515
529
|
Re: NOT_PENDING,
|
|
516
530
|
Ae: null,
|
|
517
|
-
|
|
531
|
+
Et: -1,
|
|
518
532
|
Ne: false,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
533
|
+
He: false,
|
|
534
|
+
Ot: undefined,
|
|
535
|
+
Ct: t,
|
|
536
|
+
Rt: n,
|
|
537
|
+
Gt: undefined,
|
|
524
538
|
ge: i,
|
|
525
539
|
o: null
|
|
526
540
|
};
|
|
@@ -529,7 +543,7 @@ function computed(e, t) {
|
|
|
529
543
|
// allocation on EVERY effect at creation (an alloc + 19 field stores,
|
|
530
544
|
// +23% effect creation, caught by the creation benches). Only genuinely
|
|
531
545
|
// per-node channels (boundaries) live on _x.
|
|
532
|
-
if (u?.unobserved) ext(o).
|
|
546
|
+
if (u?.unobserved) ext(o).Nt = u.unobserved;
|
|
533
547
|
setupComputedNode(o, lazyOptions);
|
|
534
548
|
return o;
|
|
535
549
|
}
|
|
@@ -561,23 +575,23 @@ const lazyOptions = {
|
|
|
561
575
|
|
|
562
576
|
function setupComputedNode(e, t) {
|
|
563
577
|
e.ct = e;
|
|
564
|
-
const n = context?.
|
|
578
|
+
const n = context?.Dt ? context.Pt : context;
|
|
565
579
|
if (context) {
|
|
566
|
-
const t = context.
|
|
580
|
+
const t = context.Qe;
|
|
567
581
|
if (t === null) {
|
|
568
|
-
context.
|
|
582
|
+
context.Qe = e;
|
|
569
583
|
} else {
|
|
570
|
-
e.
|
|
571
|
-
t.
|
|
572
|
-
context.
|
|
584
|
+
e.We = t;
|
|
585
|
+
t.It = e;
|
|
586
|
+
context.Qe = e;
|
|
573
587
|
}
|
|
574
588
|
}
|
|
575
|
-
if (n) e.
|
|
576
|
-
if (GlobalQueue.
|
|
589
|
+
if (n) e.qe = n.qe + 1;
|
|
590
|
+
if (GlobalQueue.Ft !== null) GlobalQueue.Ft(e);
|
|
577
591
|
!t?.lazy && recompute(e, true);
|
|
578
592
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
579
593
|
if (!(e.S & STATUS_PENDING) && !(e.T & CONFIG_NO_SNAPSHOT)) {
|
|
580
|
-
ext(e).
|
|
594
|
+
ext(e).Ye = e.be === undefined ? NO_SNAPSHOT : e.be;
|
|
581
595
|
e.T |= CONFIG_HAS_SNAPSHOT;
|
|
582
596
|
snapshotSources.add(e);
|
|
583
597
|
}
|
|
@@ -590,9 +604,9 @@ function signal(e, t, n = null) {
|
|
|
590
604
|
T: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.H ? CONFIG_NO_SNAPSHOT : 0),
|
|
591
605
|
be: e,
|
|
592
606
|
u: null,
|
|
593
|
-
|
|
607
|
+
ft: null,
|
|
594
608
|
Te: clock,
|
|
595
|
-
|
|
609
|
+
rt: n,
|
|
596
610
|
Se: n?.o?.i || null,
|
|
597
611
|
Re: NOT_PENDING,
|
|
598
612
|
// Signal-literal diet (§12e): NO _time/_fn/_statusFlags slots. Stores
|
|
@@ -601,22 +615,74 @@ function signal(e, t, n = null) {
|
|
|
601
615
|
// typed error-retry gating); _fn/_statusFlags read falsy-identically as
|
|
602
616
|
// missing properties on the shared paths (undefined masks to 0).
|
|
603
617
|
Ae: null,
|
|
604
|
-
|
|
618
|
+
Et: -1,
|
|
605
619
|
o: null
|
|
606
620
|
};
|
|
607
|
-
if (t?.unobserved) ext(i).
|
|
621
|
+
if (t?.unobserved) ext(i).Nt = t.unobserved;
|
|
608
622
|
if (n) {
|
|
609
623
|
ext(n).i = i;
|
|
610
624
|
n.T |= CONFIG_FW_CHILDREN;
|
|
611
625
|
}
|
|
612
626
|
if (snapshotCaptureActive && !(i.T & CONFIG_NO_SNAPSHOT) && !((n?.S ?? 0) & STATUS_PENDING)) {
|
|
613
|
-
ext(i).
|
|
627
|
+
ext(i).Ye = e === undefined ? NO_SNAPSHOT : e;
|
|
614
628
|
i.T |= CONFIG_HAS_SNAPSHOT;
|
|
615
629
|
snapshotSources.add(i);
|
|
616
630
|
}
|
|
617
631
|
return i;
|
|
618
632
|
}
|
|
619
633
|
|
|
634
|
+
// ---------------------------------------------------------------------------
|
|
635
|
+
// SLOT SIGNALS (store leaves) — the create-floor diet. Store mounts
|
|
636
|
+
// materialize one signal per touched leaf (~13 × rows on dbmon), so per-node
|
|
637
|
+
// allocations are mount bytes: the generic path costs an options object, an
|
|
638
|
+
// equals closure, an unobserved closure, a NodeExtension to hold it, and
|
|
639
|
+
// three post-construction expandos (acc/px/pxv → hidden-class transitions).
|
|
640
|
+
// slotSignal bakes everything into ONE literal: `_host`/`_key` backrefs
|
|
641
|
+
// replace the closures (equals is a method call — `this` is the node; the
|
|
642
|
+
// unobserved sweep dispatches CONFIG_SLOT_NODE to one shared hook), and the
|
|
643
|
+
// store's wrap-cache fields are pre-shaped.
|
|
644
|
+
/** The shared slot-node unobserved handler — a live binding read directly by
|
|
645
|
+
* the sweep sites (no wrapper frame, no null check: a CONFIG_SLOT_NODE node
|
|
646
|
+
* existing implies the store module loaded and registered the hook). */ let slotUnobservedHook;
|
|
647
|
+
|
|
648
|
+
/** Install the shared slot-node unobserved handler (store module, once). */ function setSlotUnobserved(e) {
|
|
649
|
+
slotUnobservedHook = e;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function slotSignal(e, t, n, i, u, l = null) {
|
|
653
|
+
const o = {
|
|
654
|
+
pe: t,
|
|
655
|
+
T: CONFIG_OWNED_WRITE | CONFIG_SLOT_NODE,
|
|
656
|
+
be: e,
|
|
657
|
+
u: null,
|
|
658
|
+
ft: null,
|
|
659
|
+
Te: clock,
|
|
660
|
+
rt: l,
|
|
661
|
+
Se: l?.o?.i || null,
|
|
662
|
+
Re: NOT_PENDING,
|
|
663
|
+
Ae: null,
|
|
664
|
+
Et: -1,
|
|
665
|
+
o: null,
|
|
666
|
+
// Slot backrefs: what the equals/unobserved closures used to capture.
|
|
667
|
+
ht: n,
|
|
668
|
+
Ht: i,
|
|
669
|
+
// Store read-path caches, pre-shaped (were post-construction expandos).
|
|
670
|
+
acc: u,
|
|
671
|
+
px: undefined,
|
|
672
|
+
pxv: undefined
|
|
673
|
+
};
|
|
674
|
+
if (l) {
|
|
675
|
+
ext(l).i = o;
|
|
676
|
+
l.T |= CONFIG_FW_CHILDREN;
|
|
677
|
+
}
|
|
678
|
+
if (snapshotCaptureActive && !((l?.S ?? 0) & STATUS_PENDING)) {
|
|
679
|
+
ext(o).Ye = e === undefined ? NO_SNAPSHOT : e;
|
|
680
|
+
o.T |= CONFIG_HAS_SNAPSHOT;
|
|
681
|
+
snapshotSources.add(o);
|
|
682
|
+
}
|
|
683
|
+
return o;
|
|
684
|
+
}
|
|
685
|
+
|
|
620
686
|
function optimisticSignal(e, t) {
|
|
621
687
|
const n = signal(e, t);
|
|
622
688
|
ext(n).Pe = NOT_PENDING;
|
|
@@ -657,11 +723,11 @@ function isEqual(e, t) {
|
|
|
657
723
|
* );
|
|
658
724
|
* ```
|
|
659
725
|
*/ function untrack(e, t) {
|
|
660
|
-
if (GlobalQueue.
|
|
726
|
+
if (GlobalQueue.gt === null && !tracking && true) return e();
|
|
661
727
|
const n = tracking;
|
|
662
728
|
tracking = false;
|
|
663
729
|
try {
|
|
664
|
-
if (GlobalQueue.
|
|
730
|
+
if (GlobalQueue.gt !== null) return GlobalQueue.gt(e);
|
|
665
731
|
return e();
|
|
666
732
|
} finally {
|
|
667
733
|
tracking = n;
|
|
@@ -718,22 +784,24 @@ function isEqual(e, t) {
|
|
|
718
784
|
// itself have pulled this recompute (updateIfNecessary from its own
|
|
719
785
|
// read), and the heap refuses RECOMPUTING nodes — latch so recompute's
|
|
720
786
|
// tail reschedules it with the staged value visible.
|
|
721
|
-
if (e.ie & REACTIVE_RECOMPUTING_DEPS && t.
|
|
787
|
+
if (e.ie & REACTIVE_RECOMPUTING_DEPS && t.vt === e.ze && t !== e.Be) e.ie |= REACTIVE_MISSED_WAKE;
|
|
722
788
|
enqueueSub(e);
|
|
723
789
|
}
|
|
724
790
|
schedule();
|
|
725
791
|
}
|
|
726
792
|
|
|
727
|
-
/** Installs the
|
|
728
|
-
*
|
|
729
|
-
*
|
|
793
|
+
/** Installs the authoritative-reader wakeup hook. Idempotent; called by every
|
|
794
|
+
* creator of a CONFIG_AUTHORITATIVE_READ computation — until() and refresh() —
|
|
795
|
+
* before its first read (same late-binding contract as the optimistic engine;
|
|
796
|
+
* the gating bit is only ever set by such a read, so the `!` call sites are
|
|
797
|
+
* safe once every setter installs, #3303). */ function installAuthoritativeRead() {
|
|
730
798
|
if (GlobalQueue.he === null) GlobalQueue.he = notifyAuthoritativeObservers;
|
|
731
799
|
}
|
|
732
800
|
|
|
733
801
|
function readNodeFast(e) {
|
|
734
|
-
if (latestReadActive || pendingCheckActive || e.oe || e.
|
|
802
|
+
if (latestReadActive || pendingCheckActive || e.oe || e.rt || e.o?.Pe !== undefined || e.o?.Ye !== undefined || activeTransition !== null || currentOptimisticLane !== null || snapshotCaptureActive || false) return READ_SLOW;
|
|
735
803
|
let t = context;
|
|
736
|
-
if (t?.
|
|
804
|
+
if (t?.Dt) t = t.Pt;
|
|
737
805
|
if (t && tracking) link(e, t);
|
|
738
806
|
// Children-forbidden readers (createTrackedEffect / onSettled callbacks) get
|
|
739
807
|
// committed visibility: like the effect half of createEffect and event
|
|
@@ -747,21 +815,21 @@ function read(e) {
|
|
|
747
815
|
// Checked before isPending so that isPending(() => latest(x)) checks
|
|
748
816
|
// the _pendingSignal of _latestValueComputed (async in flight) rather
|
|
749
817
|
// than the original node (which stays "pending" while held in a transition).
|
|
750
|
-
if (latestReadActive) return GlobalQueue.
|
|
818
|
+
if (latestReadActive) return GlobalQueue.Vt(e);
|
|
751
819
|
let t = context;
|
|
752
|
-
if (t?.
|
|
820
|
+
if (t?.Dt) t = t.Pt;
|
|
753
821
|
const n = e;
|
|
754
|
-
const i = e.
|
|
822
|
+
const i = e.rt;
|
|
755
823
|
const u = i || e;
|
|
756
824
|
// Handle isPending() mode: collect pending state while preserving normal read semantics.
|
|
757
825
|
// Probe mode is suspended while preparing the node so nested reads during a
|
|
758
826
|
// recompute don't collect into the probe.
|
|
759
827
|
if (pendingCheckActive) {
|
|
760
|
-
GlobalQueue.
|
|
828
|
+
GlobalQueue.bt(e, t, u, i);
|
|
761
829
|
} else if (typeof n.oe === "function") {
|
|
762
830
|
prepareComputed(e, false);
|
|
763
831
|
}
|
|
764
|
-
if (!n.oe && u === e && e.o?.Pe === undefined && e.o?.
|
|
832
|
+
if (!n.oe && u === e && e.o?.Pe === undefined && e.o?.Ye === undefined && activeTransition === null && currentOptimisticLane === null && !snapshotCaptureActive && true) {
|
|
765
833
|
if (t && tracking) link(e, t);
|
|
766
834
|
// Committed visibility for children-forbidden readers — see readNodeFast.
|
|
767
835
|
return !t || e.Re === NOT_PENDING || t.T & CONFIG_CHILDREN_FORBIDDEN ? e.be : e.Re;
|
|
@@ -770,7 +838,7 @@ function read(e) {
|
|
|
770
838
|
link(e, t, pendingCheckActive);
|
|
771
839
|
if (u.oe) {
|
|
772
840
|
const n = queueFor(e);
|
|
773
|
-
if (u.
|
|
841
|
+
if (u.qe >= n.Me) {
|
|
774
842
|
markNode(t);
|
|
775
843
|
markHeap(n);
|
|
776
844
|
updateIfNecessary(u);
|
|
@@ -782,10 +850,10 @@ function read(e) {
|
|
|
782
850
|
// node no-ops and updateIfNecessary refuses disposed nodes (#2983) —
|
|
783
851
|
// a dead target serves its last value, which is already quiescent.
|
|
784
852
|
else if (t.T & CONFIG_FRESH_READ) updateIfNecessary(u);
|
|
785
|
-
const i = u.
|
|
853
|
+
const i = u.qe;
|
|
786
854
|
// parent check is shallow, might need to be recursive
|
|
787
|
-
if (i >= t.
|
|
788
|
-
t.
|
|
855
|
+
if (i >= t.qe && e.Le !== t) {
|
|
856
|
+
t.qe = i + 1;
|
|
789
857
|
}
|
|
790
858
|
}
|
|
791
859
|
}
|
|
@@ -793,8 +861,10 @@ function read(e) {
|
|
|
793
861
|
if (t && !(stale && u.Ae && activeTransition !== u.Ae)) {
|
|
794
862
|
// Per-lane suspension lives with the engine (a non-null lane implies it
|
|
795
863
|
// is installed): under a lane, only same-lane pending async without an
|
|
796
|
-
// active override throws
|
|
797
|
-
|
|
864
|
+
// active override throws — plus uninitialized sources regardless of
|
|
865
|
+
// lane (#3276); that check rides laneSuspends so floor bundles don't
|
|
866
|
+
// pay for it.
|
|
867
|
+
if (currentOptimisticLane === null || GlobalQueue.kt(u)) {
|
|
798
868
|
if (!tracking && e !== t) link(e, t);
|
|
799
869
|
throw u.o?._;
|
|
800
870
|
}
|
|
@@ -830,7 +900,7 @@ function read(e) {
|
|
|
830
900
|
} else throw u.o?._;
|
|
831
901
|
}
|
|
832
902
|
if (snapshotCaptureActive && t && t.T & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
833
|
-
const n = e.o?.
|
|
903
|
+
const n = e.o?.Ye;
|
|
834
904
|
if (n !== undefined) {
|
|
835
905
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
836
906
|
const u = e.Re !== NOT_PENDING ? e.Re : e.be;
|
|
@@ -859,7 +929,7 @@ function read(e) {
|
|
|
859
929
|
// _pendingValue for correct fetching. The sub is recorded for replay at commit
|
|
860
930
|
// so it re-runs with the new committed view. (Gate details live with the
|
|
861
931
|
// engine — a non-null lane implies it is installed.)
|
|
862
|
-
if (currentOptimisticLane !== null && activeTransition !== null && t !== null && GlobalQueue.
|
|
932
|
+
if (currentOptimisticLane !== null && activeTransition !== null && t !== null && GlobalQueue.Ut(e, u, t)) {
|
|
863
933
|
return e.be;
|
|
864
934
|
}
|
|
865
935
|
// In optimistic lane context, return _value for optimistic/lane-assigned signals
|
|
@@ -868,7 +938,7 @@ function read(e) {
|
|
|
868
938
|
// (The lane-context clause lives with the engine.) Children-forbidden readers
|
|
869
939
|
// (createTrackedEffect / onSettled callbacks) get committed visibility — see
|
|
870
940
|
// readNodeFast (#3006).
|
|
871
|
-
const l = !t || currentOptimisticLane !== null && GlobalQueue.
|
|
941
|
+
const l = !t || currentOptimisticLane !== null && GlobalQueue.xt(e, u, t) || e.Re === NOT_PENDING || t.T & CONFIG_CHILDREN_FORBIDDEN || stale && e.Ae && activeTransition !== e.Ae ||
|
|
872
942
|
// A17 for HELD truth (#3164, see CONFIG_HELD_TRUTH): staged confirming
|
|
873
943
|
// truth — fold-staged onto an armed family, or entangle-stolen by an
|
|
874
944
|
// awaited until() — is masked from ordinary readers until its
|
|
@@ -880,7 +950,7 @@ function read(e) {
|
|
|
880
950
|
e.T & CONFIG_HELD_TRUTH && !latestReadActive && !(t.T & CONFIG_AUTHORITATIVE_READ) ? e.be : e.Re;
|
|
881
951
|
// Record that this isPending() probe observed the fresh pending value, so
|
|
882
952
|
// the probe doesn't pair "pending" with the new value (#2831).
|
|
883
|
-
if (pendingCheckActive) GlobalQueue.
|
|
953
|
+
if (pendingCheckActive) GlobalQueue.Lt(e, l);
|
|
884
954
|
if (!t && u === e && typeof n.oe === "function" && e.T & CONFIG_AUTO_DISPOSE && !(u.S & STATUS_PENDING) && !e.u) {
|
|
885
955
|
// Deferred, not inline (#3078): an inline unobserved() here made untracked
|
|
886
956
|
// reads destructive — dispose on this read, full revival recompute on the
|
|
@@ -901,7 +971,7 @@ function setSignal(e, t) {
|
|
|
901
971
|
// _overrideValue slot (flagged by CONFIG_OPTIMISTIC — a masked read of the
|
|
902
972
|
// always-present config instead of a missing-property probe), and every
|
|
903
973
|
// module that installs one installs the engine first.
|
|
904
|
-
if (e.T & CONFIG_OPTIMISTIC && !projectionWriteActive) return GlobalQueue.
|
|
974
|
+
if (e.T & CONFIG_OPTIMISTIC && !projectionWriteActive) return GlobalQueue.yt(e, t);
|
|
905
975
|
const n = e.Re === NOT_PENDING ? e.be : e.Re;
|
|
906
976
|
if (typeof t === "function") t = t(n);
|
|
907
977
|
// Uninitialized check first: the first commit has no previous value, so the
|
|
@@ -925,7 +995,7 @@ function setSignal(e, t) {
|
|
|
925
995
|
// (epoch) — re-stages the value and stops. The walk is idempotent (subs
|
|
926
996
|
// marked, heap entries flag-guarded, effects queued once); lane and reask
|
|
927
997
|
// contexts change what a walk MEANS, so they always walk.
|
|
928
|
-
if (u && e.
|
|
998
|
+
if (u && e.Et === notifyEpoch && currentOptimisticLane === null && !reaskArmed) return t;
|
|
929
999
|
insertSubs(e);
|
|
930
1000
|
schedule();
|
|
931
1001
|
return t;
|
|
@@ -944,7 +1014,7 @@ function setSignal(e, t) {
|
|
|
944
1014
|
schedule();
|
|
945
1015
|
}
|
|
946
1016
|
e.ie = e.ie & -4 | REACTIVE_MANUAL_WRITE;
|
|
947
|
-
e.
|
|
1017
|
+
e.Qt = clock;
|
|
948
1018
|
}
|
|
949
1019
|
|
|
950
1020
|
/**
|
|
@@ -1014,10 +1084,16 @@ function staleValues(e, t = true) {
|
|
|
1014
1084
|
// refresh is a later, explicit re-ask and lifts the mask — otherwise
|
|
1015
1085
|
// any setStore early in an action silently swallows every refresh()
|
|
1016
1086
|
// for the rest of the transaction (#3026).
|
|
1017
|
-
if (e.
|
|
1087
|
+
if (e.Qt === clock) return;
|
|
1018
1088
|
e.ie &= ~REACTIVE_MANUAL_WRITE;
|
|
1019
|
-
//
|
|
1020
|
-
//
|
|
1089
|
+
// The lift falls through to the re-ask classification below. The held
|
|
1090
|
+
// write's value change already rides the transaction; the refetch it
|
|
1091
|
+
// asks for is the same question with unchanged inputs. Skipping the
|
|
1092
|
+
// mark here classified that refetch as a NEW question, which pends
|
|
1093
|
+
// every leaf (3.1) — an action doing setStore + yield + refresh(store)
|
|
1094
|
+
// lit up every sibling row, and affects() could not narrow it (a mark
|
|
1095
|
+
// only turns pending on). Same-question motion stays silent (3.4);
|
|
1096
|
+
// the written slot and any declared mark carry the pending instead.
|
|
1021
1097
|
}
|
|
1022
1098
|
// A refresh with no value-change dirt already queued is a re-ask of the
|
|
1023
1099
|
// same question: mark it so the recompute classifies any resulting
|
|
@@ -1026,7 +1102,7 @@ function staleValues(e, t = true) {
|
|
|
1026
1102
|
// REACTIVE_IN_HEAP counts as dirt: insertSubs schedules subscribers by
|
|
1027
1103
|
// heap insertion alone (no DIRTY/CHECK flag), so a same-batch value
|
|
1028
1104
|
// change followed by refresh() must not be laundered into a quiet re-ask.
|
|
1029
|
-
|
|
1105
|
+
if (!(e.ie & (REACTIVE_DIRTY | REACTIVE_CHECK | REACTIVE_IN_HEAP))) {
|
|
1030
1106
|
e.ie |= REACTIVE_REASK;
|
|
1031
1107
|
armReaskClear();
|
|
1032
1108
|
}
|
|
@@ -1036,4 +1112,4 @@ function staleValues(e, t = true) {
|
|
|
1036
1112
|
}
|
|
1037
1113
|
}
|
|
1038
1114
|
|
|
1039
|
-
export { READ_SLOW, clearSnapshots, computed, context, createEffectNode, currentOptimisticLane, effectStatusNotify, ext, installAuthoritativeRead, isEqual, latestReadActive, markRefresh, markSnapshotScope, notifyAuthoritativeObservers, optimisticComputed, optimisticSignal, pendingCheckActive, prepareComputed, read, readNodeFast, recompute, releaseSnapshotScope, runWithOwner, setContextInternal, setEffectStatusNotify, setLatestReadActive, setMemo, setPendingCheckActive, setSignal, setSnapshotCapture, signal, snapshotCaptureActive, snapshotSources, stale, staleValues, statusNotifierOf, suppressComputedRecompute, tracking, untrack };
|
|
1115
|
+
export { READ_SLOW, clearSnapshots, computed, context, createEffectNode, currentOptimisticLane, effectStatusNotify, ext, installAuthoritativeRead, isEqual, latestReadActive, markRefresh, markSnapshotScope, notifyAuthoritativeObservers, optimisticComputed, optimisticSignal, pendingCheckActive, prepareComputed, read, readNodeFast, recompute, releaseSnapshotScope, runWithOwner, setContextInternal, setEffectStatusNotify, setLatestReadActive, setMemo, setPendingCheckActive, setSignal, setSlotUnobserved, setSnapshotCapture, signal, slotSignal, slotUnobservedHook, snapshotCaptureActive, snapshotSources, stale, staleValues, statusNotifierOf, suppressComputedRecompute, tracking, untrack };
|