@solidjs/signals 2.0.0-beta.24 → 2.0.0-beta.26
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 +577 -87
- package/dist/node.cjs +1120 -683
- package/dist/prod/core/async.js +180 -107
- package/dist/prod/core/core.js +214 -180
- package/dist/prod/core/effect.js +19 -19
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +25 -25
- package/dist/prod/core/heap.js +23 -23
- package/dist/prod/core/lanes.js +15 -15
- package/dist/prod/core/optimistic.js +42 -40
- package/dist/prod/core/owner.js +41 -41
- package/dist/prod/core/scheduler.js +90 -90
- 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 +18 -11
- package/dist/prod/store/projection.js +25 -18
- package/dist/prod/store/reconcile.js +405 -211
- package/dist/prod/store/store.js +225 -105
- package/dist/prod/store/utils.js +22 -22
- package/dist/types/core/async.d.ts +1 -0
- package/dist/types/core/core.d.ts +15 -0
- package/dist/types/store/optimistic.d.ts +1 -1
- package/dist/types/store/store.d.ts +20 -2
- package/dist/types-cjs/core/async.d.cts +1 -0
- package/dist/types-cjs/core/core.d.cts +15 -0
- package/dist/types-cjs/store/optimistic.d.cts +1 -1
- package/dist/types-cjs/store/store.d.cts +20 -2
- package/package.json +1 -1
package/dist/prod/core/owner.js
CHANGED
|
@@ -12,7 +12,7 @@ const PENDING_OWNER = {};
|
|
|
12
12
|
|
|
13
13
|
// Dummy owner to trigger store's read() path
|
|
14
14
|
function markDisposal(e) {
|
|
15
|
-
let n = e.
|
|
15
|
+
let n = e.ke;
|
|
16
16
|
while (n) {
|
|
17
17
|
const e = n.se;
|
|
18
18
|
n.se = e | REACTIVE_ZOMBIE;
|
|
@@ -26,17 +26,17 @@ function markDisposal(e) {
|
|
|
26
26
|
if (e & REACTIVE_IN_HEAP) insertIntoHeap(n, zombieQueue); else insertIntoHeapHeight(n, zombieQueue);
|
|
27
27
|
}
|
|
28
28
|
markDisposal(n);
|
|
29
|
-
n = n.
|
|
29
|
+
n = n.Fe;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function dispose(e) {
|
|
34
|
-
let n = e.
|
|
34
|
+
let n = e.et;
|
|
35
35
|
while (n !== null) {
|
|
36
36
|
n = unlinkSubs(n);
|
|
37
37
|
}
|
|
38
|
-
e.
|
|
39
|
-
e.
|
|
38
|
+
e.et = null;
|
|
39
|
+
e.We = null;
|
|
40
40
|
disposeChildren(e, true);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -51,41 +51,41 @@ function disposeChildren(e, n = false, t) {
|
|
|
51
51
|
// edge). Snap runs after the DISPOSED flag is set so the oracle reads
|
|
52
52
|
// false, and notifies subscribers still watching the companion.
|
|
53
53
|
const n = e;
|
|
54
|
-
if (n.
|
|
54
|
+
if (n.he || n.Ge) GlobalQueue.un(n);
|
|
55
55
|
}
|
|
56
|
-
if (n && e.
|
|
57
|
-
let l = t ? e.
|
|
56
|
+
if (n && e.ae) e.Te = null;
|
|
57
|
+
let l = t ? e.Qe : e.ke;
|
|
58
58
|
while (l) {
|
|
59
|
-
const e = l.
|
|
60
|
-
if (l.
|
|
59
|
+
const e = l.Fe;
|
|
60
|
+
if (l.et) {
|
|
61
61
|
const e = l;
|
|
62
62
|
deleteFromHeap(e, queueFor(e));
|
|
63
|
-
let n = e.
|
|
63
|
+
let n = e.et;
|
|
64
64
|
do {
|
|
65
65
|
n = unlinkSubs(n);
|
|
66
66
|
} while (n !== null);
|
|
67
|
-
e.
|
|
68
|
-
e.
|
|
67
|
+
e.et = null;
|
|
68
|
+
e.We = null;
|
|
69
69
|
}
|
|
70
70
|
disposeChildren(l, true);
|
|
71
71
|
l = e;
|
|
72
72
|
}
|
|
73
73
|
if (t) {
|
|
74
|
-
e.
|
|
74
|
+
e.Qe = null;
|
|
75
75
|
} else {
|
|
76
|
-
e.
|
|
77
|
-
e.
|
|
76
|
+
e.ke = null;
|
|
77
|
+
e.qe = 0;
|
|
78
78
|
}
|
|
79
79
|
// O(1) splice out of parent's chain on individual dispose. Skipped during
|
|
80
80
|
// batch dispose (parent already disposed) and zombie disposal (node sits on
|
|
81
81
|
// parent's _pendingFirstChild). We leave node._nextSibling intact so outer
|
|
82
82
|
// walks that already advanced past us still reach later siblings.
|
|
83
|
-
if (n && !t && !(i & REACTIVE_ZOMBIE) && e.
|
|
84
|
-
const n = e.
|
|
85
|
-
const t = e.
|
|
86
|
-
if (n !== null) n.
|
|
87
|
-
if (t !== null) t.
|
|
88
|
-
e.
|
|
83
|
+
if (n && !t && !(i & REACTIVE_ZOMBIE) && e.ve !== null && !(e.ve.se & REACTIVE_DISPOSED)) {
|
|
84
|
+
const n = e.rt;
|
|
85
|
+
const t = e.Fe;
|
|
86
|
+
if (n !== null) n.Fe = t; else e.ve.ke = t;
|
|
87
|
+
if (t !== null) t.rt = n;
|
|
88
|
+
e.rt = null;
|
|
89
89
|
}
|
|
90
90
|
runDisposal(e, t);
|
|
91
91
|
// Final effect-returned cleanup fires at true disposal, after `_disposal`
|
|
@@ -98,7 +98,7 @@ function disposeChildren(e, n = false, t) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
function runDisposal(e, n) {
|
|
101
|
-
let t = n ? e.ye : e.
|
|
101
|
+
let t = n ? e.ye : e.Le;
|
|
102
102
|
if (!t) return;
|
|
103
103
|
if (Array.isArray(t)) {
|
|
104
104
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -108,13 +108,13 @@ function runDisposal(e, n) {
|
|
|
108
108
|
} else {
|
|
109
109
|
t.call(t);
|
|
110
110
|
}
|
|
111
|
-
n ? e.ye = null : e.
|
|
111
|
+
n ? e.ye = null : e.Le = null;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function childId(e, n) {
|
|
115
115
|
let t = e;
|
|
116
|
-
while (t.T & CONFIG_TRANSPARENT && t.
|
|
117
|
-
if (t.id != null) return formatId(t.id, n ? t.
|
|
116
|
+
while (t.T & CONFIG_TRANSPARENT && t.ve) t = t.ve;
|
|
117
|
+
if (t.id != null) return formatId(t.id, n ? t.qe++ : t.qe);
|
|
118
118
|
throw new Error("");
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -195,7 +195,7 @@ function formatId(e, n) {
|
|
|
195
195
|
* checks. `cleanup()` is the unchecked primitive used by internals.
|
|
196
196
|
*/ function cleanup(e) {
|
|
197
197
|
if (!context) return e;
|
|
198
|
-
if (!context.
|
|
198
|
+
if (!context.Le) context.Le = e; else if (Array.isArray(context.Le)) context.Le.push(e); else context.Le = [ context.Le, e ];
|
|
199
199
|
return e;
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -235,28 +235,28 @@ function disposeRootSelf(e = true) {
|
|
|
235
235
|
const i = {
|
|
236
236
|
id: inheritId(e, t, n),
|
|
237
237
|
T: t ? CONFIG_TRANSPARENT : 0,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
Nt: true,
|
|
239
|
+
Tt: n?.Nt ? n.Tt : n,
|
|
240
|
+
ke: null,
|
|
241
|
+
Fe: null,
|
|
242
|
+
rt: null,
|
|
243
|
+
Le: null,
|
|
244
244
|
C: n?.C ?? globalQueue,
|
|
245
245
|
we: n?.we || defaultContext,
|
|
246
|
-
|
|
246
|
+
qe: 0,
|
|
247
247
|
ye: null,
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
Qe: null,
|
|
249
|
+
ve: n,
|
|
250
250
|
dispose: disposeRootSelf
|
|
251
251
|
};
|
|
252
252
|
if (n) {
|
|
253
|
-
const e = n.
|
|
253
|
+
const e = n.ke;
|
|
254
254
|
if (e === null) {
|
|
255
|
-
n.
|
|
255
|
+
n.ke = i;
|
|
256
256
|
} else {
|
|
257
|
-
i.
|
|
258
|
-
e.
|
|
259
|
-
n.
|
|
257
|
+
i.Fe = e;
|
|
258
|
+
e.rt = i;
|
|
259
|
+
n.ke = i;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
return i;
|
|
@@ -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._e !== 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
|
/**
|
|
@@ -180,29 +180,29 @@ function notifyHalted() {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
class Queue {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
ve=null;
|
|
184
|
+
gt=[ [], [] ];
|
|
185
185
|
vt=[];
|
|
186
186
|
created=clock;
|
|
187
187
|
addChild(e) {
|
|
188
188
|
this.vt.push(e);
|
|
189
|
-
e.
|
|
189
|
+
e.ve = this;
|
|
190
190
|
}
|
|
191
191
|
removeChild(e) {
|
|
192
192
|
const t = this.vt.indexOf(e);
|
|
193
193
|
if (t >= 0) {
|
|
194
194
|
this.vt.splice(t, 1);
|
|
195
|
-
e.
|
|
195
|
+
e.ve = null;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
notify(e, t, i, n) {
|
|
199
|
-
if (this.
|
|
199
|
+
if (this.ve) return this.ve.notify(e, t, i, n);
|
|
200
200
|
return false;
|
|
201
201
|
}
|
|
202
202
|
run(e) {
|
|
203
|
-
if (this.
|
|
204
|
-
const t = this.
|
|
205
|
-
this.
|
|
203
|
+
if (this.gt[e - 1].length) {
|
|
204
|
+
const t = this.gt[e - 1];
|
|
205
|
+
this.gt[e - 1] = [];
|
|
206
206
|
runQueue(t, e);
|
|
207
207
|
}
|
|
208
208
|
for (let t = 0; t < this.vt.length; t++) this.vt[t].run?.(e);
|
|
@@ -214,21 +214,21 @@ class Queue {
|
|
|
214
214
|
const i = findLane(currentOptimisticLane);
|
|
215
215
|
i.rn[e - 1].push(t);
|
|
216
216
|
} else {
|
|
217
|
-
this.
|
|
217
|
+
this.gt[e - 1].push(t);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
schedule();
|
|
221
221
|
}
|
|
222
222
|
stashQueues(e) {
|
|
223
|
-
e.
|
|
224
|
-
e.
|
|
225
|
-
this.
|
|
223
|
+
e.gt[0].push(...this.gt[0]);
|
|
224
|
+
e.gt[1].push(...this.gt[1]);
|
|
225
|
+
this.gt = [ [], [] ];
|
|
226
226
|
for (let t = 0; t < this.vt.length; t++) {
|
|
227
227
|
let i = this.vt[t];
|
|
228
228
|
let n = e.vt[t];
|
|
229
229
|
if (!n) {
|
|
230
230
|
n = {
|
|
231
|
-
|
|
231
|
+
gt: [ [], [] ],
|
|
232
232
|
vt: []
|
|
233
233
|
};
|
|
234
234
|
e.vt[t] = n;
|
|
@@ -237,8 +237,8 @@ class Queue {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
restoreQueues(e) {
|
|
240
|
-
this.
|
|
241
|
-
this.
|
|
240
|
+
this.gt[0].push(...e.gt[0]);
|
|
241
|
+
this.gt[1].push(...e.gt[1]);
|
|
242
242
|
for (let t = 0; t < e.vt.length; t++) {
|
|
243
243
|
const i = e.vt[t];
|
|
244
244
|
let n = this.vt[t];
|
|
@@ -248,14 +248,14 @@ class Queue {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
class GlobalQueue extends Queue {
|
|
251
|
-
|
|
251
|
+
bt=false;
|
|
252
252
|
// The current transaction-shaped batch: a plain ambient batch while no
|
|
253
253
|
// transition is active, the active transition itself after initTransition.
|
|
254
254
|
m=createBatch();
|
|
255
255
|
static pe;
|
|
256
256
|
static Ce;
|
|
257
|
-
static
|
|
258
|
-
static
|
|
257
|
+
static Xe;
|
|
258
|
+
static kt=null;
|
|
259
259
|
// Store-side hook: drops a keyless affects() mark's identity scope when the
|
|
260
260
|
// carrier node's last registration releases (wired by store.ts, mirroring
|
|
261
261
|
// _clearOptimisticStore).
|
|
@@ -269,24 +269,24 @@ class GlobalQueue extends Queue {
|
|
|
269
269
|
static h=null;
|
|
270
270
|
// External-source bridge (wired by enableExternalSource(); null while no
|
|
271
271
|
// config is active — including after _resetExternalSourceConfig()).
|
|
272
|
-
static Tt=null;
|
|
273
272
|
static It=null;
|
|
273
|
+
static dt=null;
|
|
274
274
|
// Verdict-layer hooks (wired by verdict.ts when isPending()/latest() are
|
|
275
275
|
// imported; null in apps that never use them). Call sites either guard for
|
|
276
276
|
// null or sit behind state only the verdict layer can create (`!` is safe
|
|
277
277
|
// there: `_pendingSignal`/`_latestValueComputed` are only ever assigned by
|
|
278
278
|
// verdict.ts, and `pendingCheckActive`/`latestReadActive` only flip inside
|
|
279
279
|
// isPending()/latest()).
|
|
280
|
-
static
|
|
281
|
-
static
|
|
282
|
-
static
|
|
280
|
+
static De=null;
|
|
281
|
+
static ce=null;
|
|
282
|
+
static Oe=null;
|
|
283
283
|
static un=null;
|
|
284
284
|
static St=null;
|
|
285
|
-
static
|
|
286
|
-
static
|
|
287
|
-
static
|
|
285
|
+
static At=null;
|
|
286
|
+
static Pt=null;
|
|
287
|
+
static $e=null;
|
|
288
288
|
static k=null;
|
|
289
|
-
static
|
|
289
|
+
static Dt=null;
|
|
290
290
|
// Optimistic-engine hooks (wired by core/optimistic.ts via
|
|
291
291
|
// installOptimisticEngine(), called from verdict.ts / createOptimistic /
|
|
292
292
|
// createOptimisticStore — every module that can create optimistic state).
|
|
@@ -294,21 +294,21 @@ class GlobalQueue extends Queue {
|
|
|
294
294
|
// `_overrideValue` slot, a lane in `activeLanes`, an `_optimisticNodes`
|
|
295
295
|
// entry, or a non-null `currentOptimisticLane`, so `!` invocations are safe
|
|
296
296
|
// once the gate holds.
|
|
297
|
-
static
|
|
297
|
+
static ht=null;
|
|
298
298
|
static En=null;
|
|
299
|
-
static Tn=null;
|
|
300
299
|
static dn=null;
|
|
300
|
+
static Tn=null;
|
|
301
301
|
static In=null;
|
|
302
|
-
static Ct=null;
|
|
303
|
-
static At=null;
|
|
304
302
|
static Ot=null;
|
|
305
|
-
static
|
|
303
|
+
static Ct=null;
|
|
304
|
+
static Rt=null;
|
|
305
|
+
static Ze=null;
|
|
306
|
+
static ze=null;
|
|
306
307
|
static Ke=null;
|
|
307
|
-
static Me=null;
|
|
308
308
|
static Nn=null;
|
|
309
309
|
flush() {
|
|
310
|
-
if (this.
|
|
311
|
-
this.
|
|
310
|
+
if (this.bt) return;
|
|
311
|
+
this.bt = true;
|
|
312
312
|
try {
|
|
313
313
|
if (false) ;
|
|
314
314
|
runHeap(dirtyQueue, GlobalQueue.pe);
|
|
@@ -329,7 +329,7 @@ class GlobalQueue extends Queue {
|
|
|
329
329
|
GlobalQueue.In(EFFECT_RENDER);
|
|
330
330
|
GlobalQueue.In(EFFECT_USER);
|
|
331
331
|
}
|
|
332
|
-
this.stashQueues(e.
|
|
332
|
+
this.stashQueues(e.yt);
|
|
333
333
|
clock++;
|
|
334
334
|
// A kept ambient batch may hold pending nodes (#2916): stay
|
|
335
335
|
// scheduled so the outer drain loop commits them via the plain
|
|
@@ -343,7 +343,7 @@ class GlobalQueue extends Queue {
|
|
|
343
343
|
const t = activeTransition;
|
|
344
344
|
const i = this.m;
|
|
345
345
|
i !== t && i.Qt.push(...t.Qt);
|
|
346
|
-
this.restoreQueues(t.
|
|
346
|
+
this.restoreQueues(t.yt);
|
|
347
347
|
transitions.delete(t);
|
|
348
348
|
activeTransition = null;
|
|
349
349
|
reassignPendingTransition(i.Qt);
|
|
@@ -354,7 +354,7 @@ class GlobalQueue extends Queue {
|
|
|
354
354
|
// there and must survive to the next flush.
|
|
355
355
|
const e = createBatch();
|
|
356
356
|
e.Qt = i.Qt;
|
|
357
|
-
e.
|
|
357
|
+
e.je = i.je;
|
|
358
358
|
e.A = i.A;
|
|
359
359
|
e.cn = i.cn;
|
|
360
360
|
currentBatch = this.m = e;
|
|
@@ -383,7 +383,7 @@ class GlobalQueue extends Queue {
|
|
|
383
383
|
if (false && !scheduled && !activeTransition && transitions.size === 0 && activeLanes.size === 0) ;
|
|
384
384
|
if (false) ;
|
|
385
385
|
} finally {
|
|
386
|
-
this.
|
|
386
|
+
this.bt = false;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
notify(e, t, i, n) {
|
|
@@ -398,8 +398,8 @@ class GlobalQueue extends Queue {
|
|
|
398
398
|
if (t?.l) return true;
|
|
399
399
|
if (activeTransition && t) {
|
|
400
400
|
const i = t.source;
|
|
401
|
-
let n = activeTransition.
|
|
402
|
-
if (!n) activeTransition.
|
|
401
|
+
let n = activeTransition.Ee.get(i);
|
|
402
|
+
if (!n) activeTransition.Ee.set(i, n = new Set);
|
|
403
403
|
const s = n.size;
|
|
404
404
|
n.add(e);
|
|
405
405
|
if (n.size !== s) schedule();
|
|
@@ -412,7 +412,7 @@ class GlobalQueue extends Queue {
|
|
|
412
412
|
initTransition(e) {
|
|
413
413
|
if (e) e = currentTransition(e);
|
|
414
414
|
if (e && e === activeTransition) return;
|
|
415
|
-
if (!e && activeTransition && activeTransition.
|
|
415
|
+
if (!e && activeTransition && activeTransition.Se === clock) return;
|
|
416
416
|
if (!activeTransition) {
|
|
417
417
|
activeTransition = e ?? createBatch();
|
|
418
418
|
} else if (e) {
|
|
@@ -422,7 +422,7 @@ class GlobalQueue extends Queue {
|
|
|
422
422
|
activeTransition = e;
|
|
423
423
|
}
|
|
424
424
|
transitions.add(activeTransition);
|
|
425
|
-
activeTransition.
|
|
425
|
+
activeTransition.Se = clock;
|
|
426
426
|
const t = this.m;
|
|
427
427
|
if (t !== activeTransition) {
|
|
428
428
|
// Adopt the ambient batch into the transaction, then make the
|
|
@@ -434,20 +434,20 @@ class GlobalQueue extends Queue {
|
|
|
434
434
|
// nodes, see propagateAffectsMark, #2893.
|
|
435
435
|
for (let e = 0; e < t.Qt.length; e++) {
|
|
436
436
|
const i = t.Qt[e];
|
|
437
|
-
i.
|
|
437
|
+
i.Ie = activeTransition;
|
|
438
438
|
activeTransition.Qt.push(i);
|
|
439
439
|
}
|
|
440
|
-
for (let e = 0; e < t.
|
|
441
|
-
const i = t.
|
|
442
|
-
i.
|
|
443
|
-
activeTransition.
|
|
440
|
+
for (let e = 0; e < t.je.length; e++) {
|
|
441
|
+
const i = t.je[e];
|
|
442
|
+
i.Ie = activeTransition;
|
|
443
|
+
activeTransition.je.push(i);
|
|
444
444
|
}
|
|
445
445
|
if (t.A.length) activeTransition.A.push(...t.A);
|
|
446
446
|
for (const e of t.cn) activeTransition.cn.add(e);
|
|
447
447
|
currentBatch = this.m = activeTransition;
|
|
448
448
|
}
|
|
449
449
|
for (const e of activeLanes) {
|
|
450
|
-
if (!e.
|
|
450
|
+
if (!e.Ie) e.Ie = activeTransition;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}
|
|
@@ -468,8 +468,8 @@ function armReaskClear() {
|
|
|
468
468
|
function insertSubs(e, t = false) {
|
|
469
469
|
// Get source lane: prefer node's own lane over current context
|
|
470
470
|
// This is important for isPending signals which need their own lane to flush immediately
|
|
471
|
-
const i = e.
|
|
472
|
-
const n = e.
|
|
471
|
+
const i = e.Me || currentOptimisticLane;
|
|
472
|
+
const n = e.xe !== undefined;
|
|
473
473
|
const s = reaskArmed;
|
|
474
474
|
for (let r = e.o; r !== null; r = r.ue) {
|
|
475
475
|
// A value-change notification is a new question for the subscriber: any
|
|
@@ -485,7 +485,7 @@ function insertSubs(e, t = false) {
|
|
|
485
485
|
} else if (t) {
|
|
486
486
|
r.le.se |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
487
487
|
// No source lane means reversion - clear subscriber's lane so effects go to regular queue
|
|
488
|
-
r.le.
|
|
488
|
+
r.le.Me = undefined;
|
|
489
489
|
}
|
|
490
490
|
enqueueSub(r.le);
|
|
491
491
|
}
|
|
@@ -493,24 +493,24 @@ function insertSubs(e, t = false) {
|
|
|
493
493
|
|
|
494
494
|
function commitPendingNode(e) {
|
|
495
495
|
const t = e;
|
|
496
|
-
if (!t.
|
|
497
|
-
if (e.
|
|
498
|
-
e.
|
|
499
|
-
e.
|
|
496
|
+
if (!t.ae) {
|
|
497
|
+
if (e._e !== NOT_PENDING) {
|
|
498
|
+
e.Ue = e._e;
|
|
499
|
+
e._e = NOT_PENDING;
|
|
500
500
|
}
|
|
501
|
-
if (e.
|
|
501
|
+
if (e.he || e.Ge) GlobalQueue.un(e);
|
|
502
502
|
return;
|
|
503
503
|
}
|
|
504
|
-
if (e.
|
|
505
|
-
e.
|
|
506
|
-
e.
|
|
504
|
+
if (e._e !== NOT_PENDING) {
|
|
505
|
+
e.Ue = e._e;
|
|
506
|
+
e._e = NOT_PENDING;
|
|
507
507
|
// Set _modified for effects, but not for tracked effects (they handle their own scheduling)
|
|
508
|
-
if (e.
|
|
508
|
+
if (e.Pe && e.Pe !== EFFECT_TRACKED) e.Be = true;
|
|
509
509
|
}
|
|
510
510
|
t.se &= ~REACTIVE_MANUAL_WRITE;
|
|
511
511
|
if (!(t.S & STATUS_PENDING)) t.S &= ~STATUS_UNINITIALIZED;
|
|
512
|
-
if (t.
|
|
513
|
-
if (e.
|
|
512
|
+
if (t.Qe !== null || t.ye !== null) GlobalQueue.Ce(t, false, true);
|
|
513
|
+
if (e.he || e.Ge) GlobalQueue.un(e);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
function commitPendingNodes() {
|
|
@@ -535,7 +535,7 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
535
535
|
const t = e ?? globalQueue.m;
|
|
536
536
|
// Optimistic reversion: a non-empty batch means _optimisticWrite ran,
|
|
537
537
|
// which installed the engine's hooks.
|
|
538
|
-
if (t.
|
|
538
|
+
if (t.je.length) GlobalQueue.En(t.je);
|
|
539
539
|
// Replay entanglement: subs recorded by the read-time gate get rescheduled
|
|
540
540
|
// so they re-run with the now-committed values visible.
|
|
541
541
|
if (e && e.ln.size) {
|
|
@@ -559,10 +559,10 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
559
559
|
// hook; the hook iterates, clears, and schedules (keeping the loop out of
|
|
560
560
|
// core lets esbuild shake it — rollup already folds the null guard). The
|
|
561
561
|
// completing transition scopes the clear to its own layer keys (#2899).
|
|
562
|
-
if (t.cn.size) GlobalQueue.
|
|
562
|
+
if (t.cn.size) GlobalQueue.kt(t.cn, e);
|
|
563
563
|
sweepTransientStoreNodes();
|
|
564
564
|
// Lanes only enter activeLanes through the engine's getOrCreateLane.
|
|
565
|
-
if (activeLanes.size) GlobalQueue.
|
|
565
|
+
if (activeLanes.size) GlobalQueue.Tn(e);
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
@@ -591,7 +591,7 @@ function checkBoundaryChildren(e) {
|
|
|
591
591
|
|
|
592
592
|
function reassignPendingTransition(e) {
|
|
593
593
|
for (let t = 0; t < e.length; t++) {
|
|
594
|
-
e[t].
|
|
594
|
+
e[t].Ie = activeTransition;
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
|
|
@@ -619,7 +619,7 @@ function flush(e) {
|
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
if (globalQueue.
|
|
622
|
+
if (globalQueue.bt) {
|
|
623
623
|
return;
|
|
624
624
|
}
|
|
625
625
|
if (halted) return;
|
|
@@ -637,10 +637,10 @@ function runQueue(e, t) {
|
|
|
637
637
|
function reporterBlocksSource(e, t) {
|
|
638
638
|
if (e.se & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
639
639
|
if (e.oe?.has(t)) return true;
|
|
640
|
-
for (let i = e.
|
|
641
|
-
let e = i.
|
|
640
|
+
for (let i = e.et; i; i = i.tt) {
|
|
641
|
+
let e = i.nt;
|
|
642
642
|
while (e) {
|
|
643
|
-
if (e === t || e.
|
|
643
|
+
if (e === t || e.it === t) return true;
|
|
644
644
|
e = e.nn;
|
|
645
645
|
}
|
|
646
646
|
}
|
|
@@ -651,7 +651,7 @@ function transitionComplete(e) {
|
|
|
651
651
|
if (e.fn) return true;
|
|
652
652
|
if (e.ie.length) return false;
|
|
653
653
|
let t = true;
|
|
654
|
-
for (const [i, n] of e.
|
|
654
|
+
for (const [i, n] of e.Ee) {
|
|
655
655
|
let s = false;
|
|
656
656
|
for (const e of n) {
|
|
657
657
|
if (reporterBlocksSource(e, i)) {
|
|
@@ -660,7 +660,7 @@ function transitionComplete(e) {
|
|
|
660
660
|
}
|
|
661
661
|
n.delete(e);
|
|
662
662
|
}
|
|
663
|
-
if (!s) e.
|
|
663
|
+
if (!s) e.Ee.delete(i); else if (i.S & STATUS_PENDING && i._?.source === i) {
|
|
664
664
|
t = false;
|
|
665
665
|
break;
|
|
666
666
|
}
|
|
@@ -668,7 +668,7 @@ function transitionComplete(e) {
|
|
|
668
668
|
// Override blockage lives with the engine. Absent hook = "no optimistic
|
|
669
669
|
// blockage", which is exact: only _optimisticWrite (engine) pushes to
|
|
670
670
|
// _optimisticNodes, so without the engine the loop was vacuous anyway.
|
|
671
|
-
if (t && e.
|
|
671
|
+
if (t && e.je.length && GlobalQueue.dn(e)) t = false;
|
|
672
672
|
t && (e.fn = true);
|
|
673
673
|
return t;
|
|
674
674
|
}
|