@solidjs/signals 2.0.0-beta.25 → 2.0.0-beta.27
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 +370 -73
- package/dist/node.cjs +1247 -946
- package/dist/prod/core/action.js +11 -6
- package/dist/prod/core/async.js +212 -108
- package/dist/prod/core/core.js +203 -189
- package/dist/prod/core/effect.js +28 -28
- package/dist/prod/core/external.js +3 -3
- package/dist/prod/core/graph.js +28 -28
- package/dist/prod/core/heap.js +30 -30
- package/dist/prod/core/lanes.js +15 -15
- package/dist/prod/core/optimistic.js +39 -39
- package/dist/prod/core/owner.js +44 -44
- package/dist/prod/core/scheduler.js +127 -106
- package/dist/prod/core/verdict.js +54 -54
- package/dist/prod/map.js +60 -60
- package/dist/prod/signals.js +1 -1
- package/dist/prod/store/optimistic.js +55 -36
- package/dist/prod/store/projection.js +38 -33
- package/dist/prod/store/reconcile.js +299 -243
- package/dist/prod/store/store.js +127 -50
- package/dist/types/core/async.d.ts +2 -0
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/store/optimistic.d.ts +2 -2
- package/dist/types/store/projection.d.ts +7 -2
- package/dist/types/store/reconcile.d.ts +14 -0
- package/dist/types/store/store.d.ts +2 -2
- package/dist/types-cjs/core/async.d.cts +2 -0
- package/dist/types-cjs/core/scheduler.d.cts +1 -0
- package/dist/types-cjs/store/optimistic.d.cts +2 -2
- package/dist/types-cjs/store/projection.d.cts +7 -2
- package/dist/types-cjs/store/reconcile.d.cts +14 -0
- package/dist/types-cjs/store/store.d.cts +2 -2
- package/package.json +1 -1
|
@@ -19,14 +19,14 @@ const transitions = new Set;
|
|
|
19
19
|
const dirtyQueue = {
|
|
20
20
|
eE: new Array(2e3).fill(undefined),
|
|
21
21
|
tE: false,
|
|
22
|
-
|
|
22
|
+
He: 0,
|
|
23
23
|
EE: 0
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const zombieQueue = {
|
|
27
27
|
eE: new Array(2e3).fill(undefined),
|
|
28
28
|
tE: false,
|
|
29
|
-
|
|
29
|
+
He: 0,
|
|
30
30
|
EE: 0
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -56,7 +56,7 @@ function registerTransientStoreNode(e) {
|
|
|
56
56
|
|
|
57
57
|
function canUseSimpleSyncFlush(e) {
|
|
58
58
|
const t = e.m;
|
|
59
|
-
return transitions.size === 0 && activeLanes.size === 0 && e.vt.length === 0 && t.
|
|
59
|
+
return transitions.size === 0 && activeLanes.size === 0 && e.vt.length === 0 && t.je.length === 0 && t.A.length === 0 && t.cn.size === 0 && transientStoreNodes.size === 0;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function sweepTransientStoreNodes() {
|
|
@@ -66,14 +66,14 @@ function sweepTransientStoreNodes() {
|
|
|
66
66
|
transientStoreNodes.delete(e);
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
if (e.
|
|
70
|
-
if (e.
|
|
69
|
+
if (e.De !== NOT_PENDING) continue;
|
|
70
|
+
if (e.Ae !== undefined && e.Ae !== NOT_PENDING) continue;
|
|
71
71
|
// A live affects() mark keeps the node addressable: sweeping it would
|
|
72
72
|
// detach the refcount from the slot (a fresh probe would upsert a new,
|
|
73
73
|
// unmarked node for the same property).
|
|
74
74
|
if (e.t) continue;
|
|
75
75
|
transientStoreNodes.delete(e);
|
|
76
|
-
e.
|
|
76
|
+
e.ut?.();
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -100,15 +100,15 @@ function setProjectionWriteActive(e) {
|
|
|
100
100
|
* land there directly — no per-field aliasing.
|
|
101
101
|
*/ function createBatch() {
|
|
102
102
|
return {
|
|
103
|
-
|
|
103
|
+
Se: clock,
|
|
104
104
|
Qt: [],
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
Ee: new Map,
|
|
106
|
+
je: [],
|
|
107
107
|
A: [],
|
|
108
108
|
cn: new Set,
|
|
109
109
|
ie: [],
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
yt: {
|
|
111
|
+
gt: [ [], [] ],
|
|
112
112
|
vt: []
|
|
113
113
|
},
|
|
114
114
|
fn: false,
|
|
@@ -119,13 +119,13 @@ function setProjectionWriteActive(e) {
|
|
|
119
119
|
function mergeTransitionState(e, t) {
|
|
120
120
|
t.fn = e;
|
|
121
121
|
e.ie.push(...t.ie);
|
|
122
|
-
for (const i of activeLanes) if (i.
|
|
123
|
-
if (t.
|
|
122
|
+
for (const i of activeLanes) if (i.Ie === t) i.Ie = e;
|
|
123
|
+
if (t.je.length) {
|
|
124
124
|
// Move (don't copy): the global queue's batch may still be the outgoing
|
|
125
125
|
// transition, and the adoption pass in initTransition would re-push its
|
|
126
126
|
// contents into the target — duplicating every entry.
|
|
127
|
-
e.
|
|
128
|
-
t.
|
|
127
|
+
e.je.push(...t.je);
|
|
128
|
+
t.je.length = 0;
|
|
129
129
|
}
|
|
130
130
|
if (t.A.length) {
|
|
131
131
|
// Move (don't copy): the global queue's batch may still be the outgoing
|
|
@@ -135,9 +135,9 @@ function mergeTransitionState(e, t) {
|
|
|
135
135
|
t.A.length = 0;
|
|
136
136
|
}
|
|
137
137
|
for (const i of t.cn) e.cn.add(i);
|
|
138
|
-
for (const [i, n] of t.
|
|
139
|
-
let t = e.
|
|
140
|
-
if (!t) e.
|
|
138
|
+
for (const [i, n] of t.Ee) {
|
|
139
|
+
let t = e.Ee.get(i);
|
|
140
|
+
if (!t) e.Ee.set(i, t = new Set);
|
|
141
141
|
for (const e of n) t.add(e);
|
|
142
142
|
}
|
|
143
143
|
for (const i of t.ln) e.ln.add(i);
|
|
@@ -150,7 +150,7 @@ function schedule() {
|
|
|
150
150
|
}
|
|
151
151
|
if (scheduled) return;
|
|
152
152
|
scheduled = true;
|
|
153
|
-
if (!syncDepth && !globalQueue.
|
|
153
|
+
if (!syncDepth && !globalQueue.bt && !projectionWriteActive) queueMicrotask(flush);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -179,33 +179,58 @@ function notifyHalted() {
|
|
|
179
179
|
haltNotified = false;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// Identifies one child-traversal pass in `Queue.run` so a rescan after the
|
|
183
|
+
// child list shifts can tell "already run this pass" from "still pending".
|
|
184
|
+
let queueRunToken = 0;
|
|
185
|
+
|
|
182
186
|
class Queue {
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
ve=null;
|
|
188
|
+
gt=[ [], [] ];
|
|
185
189
|
vt=[];
|
|
190
|
+
kt=0;
|
|
186
191
|
created=clock;
|
|
187
192
|
addChild(e) {
|
|
188
193
|
this.vt.push(e);
|
|
189
|
-
e.
|
|
194
|
+
e.ve = this;
|
|
190
195
|
}
|
|
191
196
|
removeChild(e) {
|
|
192
197
|
const t = this.vt.indexOf(e);
|
|
193
198
|
if (t >= 0) {
|
|
194
199
|
this.vt.splice(t, 1);
|
|
195
|
-
e.
|
|
200
|
+
e.ve = null;
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
notify(e, t, i, n) {
|
|
199
|
-
if (this.
|
|
204
|
+
if (this.ve) return this.ve.notify(e, t, i, n);
|
|
200
205
|
return false;
|
|
201
206
|
}
|
|
202
207
|
run(e) {
|
|
203
|
-
if (this.
|
|
204
|
-
const t = this.
|
|
205
|
-
this.
|
|
208
|
+
if (this.gt[e - 1].length) {
|
|
209
|
+
const t = this.gt[e - 1];
|
|
210
|
+
this.gt[e - 1] = [];
|
|
206
211
|
runQueue(t, e);
|
|
207
212
|
}
|
|
208
|
-
|
|
213
|
+
// Effects run here can dispose owners, and disposal removes queues from
|
|
214
|
+
// this list — the running child itself, an earlier sibling, or several at
|
|
215
|
+
// once. A plain index walk then skips whatever shifted into the cursor.
|
|
216
|
+
// Stamping each child before it runs makes the pass idempotent, so a shift
|
|
217
|
+
// can be recovered by rescanning from the front and every child still runs
|
|
218
|
+
// exactly once. Children appended mid-pass carry a stale stamp and run,
|
|
219
|
+
// matching the previous live-array behaviour.
|
|
220
|
+
const t = this.vt;
|
|
221
|
+
const i = ++queueRunToken;
|
|
222
|
+
for (let n = 0; n < t.length; ) {
|
|
223
|
+
const s = t[n];
|
|
224
|
+
if (s.kt !== i) {
|
|
225
|
+
s.kt = i;
|
|
226
|
+
s.run?.(e);
|
|
227
|
+
if (t[n] !== s) {
|
|
228
|
+
n = 0;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
n++;
|
|
233
|
+
}
|
|
209
234
|
}
|
|
210
235
|
enqueue(e, t) {
|
|
211
236
|
if (e) {
|
|
@@ -214,21 +239,21 @@ class Queue {
|
|
|
214
239
|
const i = findLane(currentOptimisticLane);
|
|
215
240
|
i.rn[e - 1].push(t);
|
|
216
241
|
} else {
|
|
217
|
-
this.
|
|
242
|
+
this.gt[e - 1].push(t);
|
|
218
243
|
}
|
|
219
244
|
}
|
|
220
245
|
schedule();
|
|
221
246
|
}
|
|
222
247
|
stashQueues(e) {
|
|
223
|
-
e.
|
|
224
|
-
e.
|
|
225
|
-
this.
|
|
248
|
+
e.gt[0].push(...this.gt[0]);
|
|
249
|
+
e.gt[1].push(...this.gt[1]);
|
|
250
|
+
this.gt = [ [], [] ];
|
|
226
251
|
for (let t = 0; t < this.vt.length; t++) {
|
|
227
252
|
let i = this.vt[t];
|
|
228
253
|
let n = e.vt[t];
|
|
229
254
|
if (!n) {
|
|
230
255
|
n = {
|
|
231
|
-
|
|
256
|
+
gt: [ [], [] ],
|
|
232
257
|
vt: []
|
|
233
258
|
};
|
|
234
259
|
e.vt[t] = n;
|
|
@@ -237,8 +262,8 @@ class Queue {
|
|
|
237
262
|
}
|
|
238
263
|
}
|
|
239
264
|
restoreQueues(e) {
|
|
240
|
-
this.
|
|
241
|
-
this.
|
|
265
|
+
this.gt[0].push(...e.gt[0]);
|
|
266
|
+
this.gt[1].push(...e.gt[1]);
|
|
242
267
|
for (let t = 0; t < e.vt.length; t++) {
|
|
243
268
|
const i = e.vt[t];
|
|
244
269
|
let n = this.vt[t];
|
|
@@ -248,13 +273,13 @@ class Queue {
|
|
|
248
273
|
}
|
|
249
274
|
|
|
250
275
|
class GlobalQueue extends Queue {
|
|
251
|
-
|
|
276
|
+
bt=false;
|
|
252
277
|
// The current transaction-shaped batch: a plain ambient batch while no
|
|
253
278
|
// transition is active, the active transition itself after initTransition.
|
|
254
279
|
m=createBatch();
|
|
255
|
-
static pe;
|
|
256
280
|
static Ce;
|
|
257
|
-
static
|
|
281
|
+
static me;
|
|
282
|
+
static Xe;
|
|
258
283
|
static Dt=null;
|
|
259
284
|
// Store-side hook: drops a keyless affects() mark's identity scope when the
|
|
260
285
|
// carrier node's last registration releases (wired by store.ts, mirroring
|
|
@@ -269,7 +294,7 @@ class GlobalQueue extends Queue {
|
|
|
269
294
|
static h=null;
|
|
270
295
|
// External-source bridge (wired by enableExternalSource(); null while no
|
|
271
296
|
// config is active — including after _resetExternalSourceConfig()).
|
|
272
|
-
static
|
|
297
|
+
static dt=null;
|
|
273
298
|
static It=null;
|
|
274
299
|
// Verdict-layer hooks (wired by verdict.ts when isPending()/latest() are
|
|
275
300
|
// imported; null in apps that never use them). Call sites either guard for
|
|
@@ -277,14 +302,14 @@ class GlobalQueue extends Queue {
|
|
|
277
302
|
// there: `_pendingSignal`/`_latestValueComputed` are only ever assigned by
|
|
278
303
|
// verdict.ts, and `pendingCheckActive`/`latestReadActive` only flip inside
|
|
279
304
|
// isPending()/latest()).
|
|
280
|
-
static
|
|
281
|
-
static
|
|
282
|
-
static
|
|
305
|
+
static _e=null;
|
|
306
|
+
static ce=null;
|
|
307
|
+
static Ge=null;
|
|
283
308
|
static un=null;
|
|
284
|
-
static dt=null;
|
|
285
309
|
static St=null;
|
|
286
|
-
static
|
|
287
|
-
static
|
|
310
|
+
static At=null;
|
|
311
|
+
static Pt=null;
|
|
312
|
+
static $e=null;
|
|
288
313
|
static k=null;
|
|
289
314
|
static Lt=null;
|
|
290
315
|
// Optimistic-engine hooks (wired by core/optimistic.ts via
|
|
@@ -294,29 +319,29 @@ class GlobalQueue extends Queue {
|
|
|
294
319
|
// `_overrideValue` slot, a lane in `activeLanes`, an `_optimisticNodes`
|
|
295
320
|
// entry, or a non-null `currentOptimisticLane`, so `!` invocations are safe
|
|
296
321
|
// once the gate holds.
|
|
297
|
-
static
|
|
322
|
+
static ht=null;
|
|
298
323
|
static En=null;
|
|
299
324
|
static dn=null;
|
|
300
325
|
static Tn=null;
|
|
301
326
|
static In=null;
|
|
302
|
-
static Ct=null;
|
|
303
|
-
static At=null;
|
|
304
327
|
static Ot=null;
|
|
305
|
-
static
|
|
328
|
+
static Ct=null;
|
|
329
|
+
static Rt=null;
|
|
330
|
+
static Ze=null;
|
|
331
|
+
static ze=null;
|
|
306
332
|
static Ke=null;
|
|
307
|
-
static Me=null;
|
|
308
333
|
static Nn=null;
|
|
309
334
|
flush() {
|
|
310
|
-
if (this.
|
|
311
|
-
this.
|
|
335
|
+
if (this.bt) return;
|
|
336
|
+
this.bt = true;
|
|
312
337
|
try {
|
|
313
338
|
if (false) ;
|
|
314
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
339
|
+
runHeap(dirtyQueue, GlobalQueue.Ce);
|
|
315
340
|
if (activeTransition) {
|
|
316
341
|
const e = transitionComplete(activeTransition);
|
|
317
342
|
if (!e) {
|
|
318
343
|
const e = activeTransition;
|
|
319
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
344
|
+
runHeap(zombieQueue, GlobalQueue.Ce);
|
|
320
345
|
// Detach: the stashed transition keeps its batch; ambient work that
|
|
321
346
|
// follows lands in a fresh one. If the batch is already a separate
|
|
322
347
|
// ambient one — action done() restored activeTransition without
|
|
@@ -329,12 +354,12 @@ class GlobalQueue extends Queue {
|
|
|
329
354
|
GlobalQueue.In(EFFECT_RENDER);
|
|
330
355
|
GlobalQueue.In(EFFECT_USER);
|
|
331
356
|
}
|
|
332
|
-
this.stashQueues(e.
|
|
357
|
+
this.stashQueues(e.yt);
|
|
333
358
|
clock++;
|
|
334
359
|
// A kept ambient batch may hold pending nodes (#2916): stay
|
|
335
360
|
// scheduled so the outer drain loop commits them via the plain
|
|
336
361
|
// flush path instead of leaving them until the next natural flush.
|
|
337
|
-
scheduled = dirtyQueue.EE >= dirtyQueue.
|
|
362
|
+
scheduled = dirtyQueue.EE >= dirtyQueue.He || this.m.Qt.length > 0;
|
|
338
363
|
reassignPendingTransition(e.Qt);
|
|
339
364
|
activeTransition = null;
|
|
340
365
|
finalizePureQueue(null, true);
|
|
@@ -343,7 +368,7 @@ class GlobalQueue extends Queue {
|
|
|
343
368
|
const t = activeTransition;
|
|
344
369
|
const i = this.m;
|
|
345
370
|
i !== t && i.Qt.push(...t.Qt);
|
|
346
|
-
this.restoreQueues(t.
|
|
371
|
+
this.restoreQueues(t.yt);
|
|
347
372
|
transitions.delete(t);
|
|
348
373
|
activeTransition = null;
|
|
349
374
|
reassignPendingTransition(i.Qt);
|
|
@@ -354,7 +379,7 @@ class GlobalQueue extends Queue {
|
|
|
354
379
|
// there and must survive to the next flush.
|
|
355
380
|
const e = createBatch();
|
|
356
381
|
e.Qt = i.Qt;
|
|
357
|
-
e.
|
|
382
|
+
e.je = i.je;
|
|
358
383
|
e.A = i.A;
|
|
359
384
|
e.cn = i.cn;
|
|
360
385
|
currentBatch = this.m = e;
|
|
@@ -362,18 +387,18 @@ class GlobalQueue extends Queue {
|
|
|
362
387
|
} else {
|
|
363
388
|
if (canUseSimpleSyncFlush(this)) {
|
|
364
389
|
commitPendingNodes();
|
|
365
|
-
if (dirtyQueue.EE >= dirtyQueue.
|
|
366
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
390
|
+
if (dirtyQueue.EE >= dirtyQueue.He) {
|
|
391
|
+
runHeap(dirtyQueue, GlobalQueue.Ce);
|
|
367
392
|
commitPendingNodes();
|
|
368
393
|
}
|
|
369
394
|
} else {
|
|
370
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
395
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.Ce);
|
|
371
396
|
finalizePureQueue();
|
|
372
397
|
}
|
|
373
398
|
}
|
|
374
399
|
clock++;
|
|
375
400
|
// Check if finalization added items to the heap (from optimistic reversion)
|
|
376
|
-
scheduled = dirtyQueue.EE >= dirtyQueue.
|
|
401
|
+
scheduled = dirtyQueue.EE >= dirtyQueue.He;
|
|
377
402
|
// Run lane effects first (for ready lanes), then regular effects
|
|
378
403
|
activeLanes.size && GlobalQueue.In(EFFECT_RENDER);
|
|
379
404
|
this.run(EFFECT_RENDER);
|
|
@@ -383,7 +408,7 @@ class GlobalQueue extends Queue {
|
|
|
383
408
|
if (false && !scheduled && !activeTransition && transitions.size === 0 && activeLanes.size === 0) ;
|
|
384
409
|
if (false) ;
|
|
385
410
|
} finally {
|
|
386
|
-
this.
|
|
411
|
+
this.bt = false;
|
|
387
412
|
}
|
|
388
413
|
}
|
|
389
414
|
notify(e, t, i, n) {
|
|
@@ -398,8 +423,8 @@ class GlobalQueue extends Queue {
|
|
|
398
423
|
if (t?.l) return true;
|
|
399
424
|
if (activeTransition && t) {
|
|
400
425
|
const i = t.source;
|
|
401
|
-
let n = activeTransition.
|
|
402
|
-
if (!n) activeTransition.
|
|
426
|
+
let n = activeTransition.Ee.get(i);
|
|
427
|
+
if (!n) activeTransition.Ee.set(i, n = new Set);
|
|
403
428
|
const s = n.size;
|
|
404
429
|
n.add(e);
|
|
405
430
|
if (n.size !== s) schedule();
|
|
@@ -412,7 +437,7 @@ class GlobalQueue extends Queue {
|
|
|
412
437
|
initTransition(e) {
|
|
413
438
|
if (e) e = currentTransition(e);
|
|
414
439
|
if (e && e === activeTransition) return;
|
|
415
|
-
if (!e && activeTransition && activeTransition.
|
|
440
|
+
if (!e && activeTransition && activeTransition.Se === clock) return;
|
|
416
441
|
if (!activeTransition) {
|
|
417
442
|
activeTransition = e ?? createBatch();
|
|
418
443
|
} else if (e) {
|
|
@@ -422,7 +447,7 @@ class GlobalQueue extends Queue {
|
|
|
422
447
|
activeTransition = e;
|
|
423
448
|
}
|
|
424
449
|
transitions.add(activeTransition);
|
|
425
|
-
activeTransition.
|
|
450
|
+
activeTransition.Se = clock;
|
|
426
451
|
const t = this.m;
|
|
427
452
|
if (t !== activeTransition) {
|
|
428
453
|
// Adopt the ambient batch into the transaction, then make the
|
|
@@ -434,20 +459,20 @@ class GlobalQueue extends Queue {
|
|
|
434
459
|
// nodes, see propagateAffectsMark, #2893.
|
|
435
460
|
for (let e = 0; e < t.Qt.length; e++) {
|
|
436
461
|
const i = t.Qt[e];
|
|
437
|
-
i.
|
|
462
|
+
i.Ie = activeTransition;
|
|
438
463
|
activeTransition.Qt.push(i);
|
|
439
464
|
}
|
|
440
|
-
for (let e = 0; e < t.
|
|
441
|
-
const i = t.
|
|
442
|
-
i.
|
|
443
|
-
activeTransition.
|
|
465
|
+
for (let e = 0; e < t.je.length; e++) {
|
|
466
|
+
const i = t.je[e];
|
|
467
|
+
i.Ie = activeTransition;
|
|
468
|
+
activeTransition.je.push(i);
|
|
444
469
|
}
|
|
445
470
|
if (t.A.length) activeTransition.A.push(...t.A);
|
|
446
471
|
for (const e of t.cn) activeTransition.cn.add(e);
|
|
447
472
|
currentBatch = this.m = activeTransition;
|
|
448
473
|
}
|
|
449
474
|
for (const e of activeLanes) {
|
|
450
|
-
if (!e.
|
|
475
|
+
if (!e.Ie) e.Ie = activeTransition;
|
|
451
476
|
}
|
|
452
477
|
}
|
|
453
478
|
}
|
|
@@ -468,8 +493,8 @@ function armReaskClear() {
|
|
|
468
493
|
function insertSubs(e, t = false) {
|
|
469
494
|
// Get source lane: prefer node's own lane over current context
|
|
470
495
|
// This is important for isPending signals which need their own lane to flush immediately
|
|
471
|
-
const i = e.
|
|
472
|
-
const n = e.
|
|
496
|
+
const i = e.Me || currentOptimisticLane;
|
|
497
|
+
const n = e.xe !== undefined;
|
|
473
498
|
const s = reaskArmed;
|
|
474
499
|
for (let r = e.o; r !== null; r = r.ue) {
|
|
475
500
|
// A value-change notification is a new question for the subscriber: any
|
|
@@ -485,7 +510,7 @@ function insertSubs(e, t = false) {
|
|
|
485
510
|
} else if (t) {
|
|
486
511
|
r.le.se |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
487
512
|
// No source lane means reversion - clear subscriber's lane so effects go to regular queue
|
|
488
|
-
r.le.
|
|
513
|
+
r.le.Me = undefined;
|
|
489
514
|
}
|
|
490
515
|
enqueueSub(r.le);
|
|
491
516
|
}
|
|
@@ -493,24 +518,24 @@ function insertSubs(e, t = false) {
|
|
|
493
518
|
|
|
494
519
|
function commitPendingNode(e) {
|
|
495
520
|
const t = e;
|
|
496
|
-
if (!t.
|
|
497
|
-
if (e.
|
|
498
|
-
e.
|
|
499
|
-
e.
|
|
521
|
+
if (!t.ae) {
|
|
522
|
+
if (e.De !== NOT_PENDING) {
|
|
523
|
+
e.Ue = e.De;
|
|
524
|
+
e.De = NOT_PENDING;
|
|
500
525
|
}
|
|
501
|
-
if (e.
|
|
526
|
+
if (e.he || e.pe) GlobalQueue.un(e);
|
|
502
527
|
return;
|
|
503
528
|
}
|
|
504
|
-
if (e.
|
|
505
|
-
e.
|
|
506
|
-
e.
|
|
529
|
+
if (e.De !== NOT_PENDING) {
|
|
530
|
+
e.Ue = e.De;
|
|
531
|
+
e.De = NOT_PENDING;
|
|
507
532
|
// Set _modified for effects, but not for tracked effects (they handle their own scheduling)
|
|
508
|
-
if (e.
|
|
533
|
+
if (e.Pe && e.Pe !== EFFECT_TRACKED) e.Be = true;
|
|
509
534
|
}
|
|
510
535
|
t.se &= ~REACTIVE_MANUAL_WRITE;
|
|
511
536
|
if (!(t.S & STATUS_PENDING)) t.S &= ~STATUS_UNINITIALIZED;
|
|
512
|
-
if (t.
|
|
513
|
-
if (e.
|
|
537
|
+
if (t.Qe !== null || t.ye !== null) GlobalQueue.me(t, false, true);
|
|
538
|
+
if (e.he || e.pe) GlobalQueue.un(e);
|
|
514
539
|
}
|
|
515
540
|
|
|
516
541
|
function commitPendingNodes() {
|
|
@@ -527,15 +552,15 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
527
552
|
const i = !t;
|
|
528
553
|
if (i) commitPendingNodes();
|
|
529
554
|
if (!t && globalQueue.vt.length) checkBoundaryChildren(globalQueue);
|
|
530
|
-
const n = dirtyQueue.EE >= dirtyQueue.
|
|
531
|
-
if (n) runHeap(dirtyQueue, GlobalQueue.
|
|
555
|
+
const n = dirtyQueue.EE >= dirtyQueue.He;
|
|
556
|
+
if (n) runHeap(dirtyQueue, GlobalQueue.Ce);
|
|
532
557
|
if (i) {
|
|
533
558
|
if (n) commitPendingNodes();
|
|
534
559
|
// The settling batch: the completing transaction's, or the ambient one.
|
|
535
560
|
const t = e ?? globalQueue.m;
|
|
536
561
|
// Optimistic reversion: a non-empty batch means _optimisticWrite ran,
|
|
537
562
|
// which installed the engine's hooks.
|
|
538
|
-
if (t.
|
|
563
|
+
if (t.je.length) GlobalQueue.En(t.je);
|
|
539
564
|
// Replay entanglement: subs recorded by the read-time gate get rescheduled
|
|
540
565
|
// so they re-run with the now-committed values visible.
|
|
541
566
|
if (e && e.ln.size) {
|
|
@@ -591,7 +616,7 @@ function checkBoundaryChildren(e) {
|
|
|
591
616
|
|
|
592
617
|
function reassignPendingTransition(e) {
|
|
593
618
|
for (let t = 0; t < e.length; t++) {
|
|
594
|
-
e[t].
|
|
619
|
+
e[t].Ie = activeTransition;
|
|
595
620
|
}
|
|
596
621
|
}
|
|
597
622
|
|
|
@@ -619,7 +644,7 @@ function flush(e) {
|
|
|
619
644
|
}
|
|
620
645
|
}
|
|
621
646
|
}
|
|
622
|
-
if (globalQueue.
|
|
647
|
+
if (globalQueue.bt) {
|
|
623
648
|
return;
|
|
624
649
|
}
|
|
625
650
|
if (halted) return;
|
|
@@ -637,10 +662,10 @@ function runQueue(e, t) {
|
|
|
637
662
|
function reporterBlocksSource(e, t) {
|
|
638
663
|
if (e.se & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
639
664
|
if (e.oe?.has(t)) return true;
|
|
640
|
-
for (let i = e.
|
|
641
|
-
let e = i.
|
|
665
|
+
for (let i = e.et; i; i = i.tt) {
|
|
666
|
+
let e = i.nt;
|
|
642
667
|
while (e) {
|
|
643
|
-
if (e === t || e.
|
|
668
|
+
if (e === t || e.it === t) return true;
|
|
644
669
|
e = e.nn;
|
|
645
670
|
}
|
|
646
671
|
}
|
|
@@ -651,7 +676,7 @@ function transitionComplete(e) {
|
|
|
651
676
|
if (e.fn) return true;
|
|
652
677
|
if (e.ie.length) return false;
|
|
653
678
|
let t = true;
|
|
654
|
-
for (const [i, n] of e.
|
|
679
|
+
for (const [i, n] of e.Ee) {
|
|
655
680
|
let s = false;
|
|
656
681
|
for (const e of n) {
|
|
657
682
|
if (reporterBlocksSource(e, i)) {
|
|
@@ -660,15 +685,15 @@ function transitionComplete(e) {
|
|
|
660
685
|
}
|
|
661
686
|
n.delete(e);
|
|
662
687
|
}
|
|
663
|
-
if (!s) e.
|
|
688
|
+
if (!s) e.Ee.delete(i); else if (i.S & STATUS_PENDING && i._?.source === i) {
|
|
664
689
|
t = false;
|
|
665
690
|
break;
|
|
666
691
|
}
|
|
667
692
|
}
|
|
668
|
-
// Override blockage lives with the engine
|
|
669
|
-
// blockage"
|
|
670
|
-
//
|
|
671
|
-
if (t &&
|
|
693
|
+
// Override blockage lives with the engine (absent hook = "no optimistic
|
|
694
|
+
// blockage"); the hook's loops over _optimisticNodes/_optimisticStores are
|
|
695
|
+
// no-ops when the transition holds neither, so no pre-check is needed.
|
|
696
|
+
if (t && GlobalQueue.dn?.(e)) t = false;
|
|
672
697
|
t && (e.fn = true);
|
|
673
698
|
return t;
|
|
674
699
|
}
|
|
@@ -678,10 +703,6 @@ function currentTransition(e) {
|
|
|
678
703
|
return e;
|
|
679
704
|
}
|
|
680
705
|
|
|
681
|
-
function setActiveTransition(e) {
|
|
682
|
-
activeTransition = e;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
706
|
function runInTransition(e, t) {
|
|
686
707
|
const i = activeTransition;
|
|
687
708
|
try {
|
|
@@ -692,4 +713,4 @@ function runInTransition(e, t) {
|
|
|
692
713
|
}
|
|
693
714
|
}
|
|
694
715
|
|
|
695
|
-
export { GlobalQueue, Queue, activeAffectsMarks, activeLanes, activeTransition, armReaskClear, assignOrMergeLane, clock, currentTransition, dirtyQueue, enforceLoadingBoundary, finalizePureQueue, findLane, flush, globalQueue, haltReactivity, insertSubs, projectionWriteActive, queuePendingNode, registerTransientStoreNode, resetErrorHalt, runInTransition, schedule,
|
|
716
|
+
export { GlobalQueue, Queue, activeAffectsMarks, activeLanes, activeTransition, armReaskClear, assignOrMergeLane, clock, currentTransition, dirtyQueue, enforceLoadingBoundary, finalizePureQueue, findLane, flush, globalQueue, haltReactivity, insertSubs, projectionWriteActive, queuePendingNode, registerTransientStoreNode, resetErrorHalt, runInTransition, schedule, setProjectionWriteActive, shiftAffectsMarks, zombieQueue };
|