@solidjs/signals 2.0.0-rc.3 → 2.0.0-rc.4
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 +1334 -94
- package/dist/node.cjs +2589 -1367
- package/dist/prod/affects.js +13 -12
- package/dist/prod/boundaries.js +39 -34
- package/dist/prod/core/action.js +3 -3
- package/dist/prod/core/async.js +48 -46
- package/dist/prod/core/core.js +99 -67
- package/dist/prod/core/effect.js +25 -28
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +85 -49
- package/dist/prod/core/heap.js +10 -10
- package/dist/prod/core/lanes.js +19 -19
- package/dist/prod/core/optimistic.js +36 -33
- package/dist/prod/core/owner.js +13 -13
- package/dist/prod/core/scheduler.js +131 -85
- package/dist/prod/core/verdict.js +29 -15
- package/dist/prod/index.js +4 -0
- package/dist/prod/map.js +101 -101
- package/dist/prod/signals.js +1 -1
- package/dist/prod/store/index.js +2 -0
- package/dist/prod/store/next/optimistic.js +65 -11
- package/dist/prod/store/next/patch-hooks.js +13 -0
- package/dist/prod/store/next/patch.js +614 -0
- package/dist/prod/store/next/reconcile.js +307 -120
- package/dist/prod/store/next/store.js +321 -92
- package/dist/prod/store/next/target.js +13 -4
- package/dist/prod/store/store.js +5 -5
- package/dist/types/core/core.d.ts +15 -1
- package/dist/types/core/dev.d.ts +8 -0
- package/dist/types/core/graph.d.ts +22 -0
- package/dist/types/core/scheduler.d.ts +12 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/next/patch-hooks.d.ts +41 -0
- package/dist/types/store/next/patch.d.ts +91 -0
- package/dist/types/store/next/reconcile.d.ts +14 -0
- package/dist/types/store/next/store.d.ts +30 -2
- package/dist/types/store/next/target.d.ts +58 -8
- package/dist/types-cjs/core/core.d.cts +15 -1
- package/dist/types-cjs/core/dev.d.cts +8 -0
- package/dist/types-cjs/core/graph.d.cts +22 -0
- package/dist/types-cjs/core/scheduler.d.cts +12 -0
- package/dist/types-cjs/store/index.d.cts +2 -0
- package/dist/types-cjs/store/next/patch-hooks.d.cts +41 -0
- package/dist/types-cjs/store/next/patch.d.cts +91 -0
- package/dist/types-cjs/store/next/reconcile.d.cts +14 -0
- package/dist/types-cjs/store/next/store.d.cts +30 -2
- package/dist/types-cjs/store/next/target.d.cts +58 -8
- package/package.json +2 -2
package/dist/prod/affects.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forEachDependent } from "./core/async.js";
|
|
2
2
|
|
|
3
|
-
import { ext } from "./core/core.js";
|
|
3
|
+
import { ext, statusNotifierOf } from "./core/core.js";
|
|
4
4
|
|
|
5
5
|
import { $REFRESH, STATUS_PENDING } from "./core/constants.js";
|
|
6
6
|
|
|
@@ -40,17 +40,18 @@ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
|
|
|
40
40
|
* flush that would surface them, before effects run — verdict-only, netting
|
|
41
41
|
* no visual change.
|
|
42
42
|
*/ function notifyMarkBoundaries(e) {
|
|
43
|
-
if (!e.u && !e.o?.
|
|
43
|
+
if (!e.u && !e.o?.i) return;
|
|
44
44
|
const r = new NotReadyError(e);
|
|
45
|
-
r.
|
|
45
|
+
r.l = true;
|
|
46
46
|
const t = new Set;
|
|
47
47
|
const visit = e => {
|
|
48
48
|
if (t.has(e)) return;
|
|
49
49
|
t.add(e);
|
|
50
50
|
// Display consumers (render effects, boundary computeds) act on the
|
|
51
51
|
// notification; descent stops there, exactly like the status rails.
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const o = statusNotifierOf(e);
|
|
53
|
+
if (o) {
|
|
54
|
+
o.call(e, STATUS_PENDING, r);
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
forEachDependent(e, visit);
|
|
@@ -68,10 +69,10 @@ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
|
|
|
68
69
|
* earlier overlapping registration get covered, and dedup stops re-descent.
|
|
69
70
|
*/ function registerAffectsMark(e) {
|
|
70
71
|
markAffects(e);
|
|
71
|
-
globalQueue.
|
|
72
|
+
globalQueue.m.A.push(e);
|
|
72
73
|
// Companions only exist once the verdict layer (isPending/latest) loaded;
|
|
73
74
|
// without them there is no materialized verdict to poke.
|
|
74
|
-
GlobalQueue.
|
|
75
|
+
GlobalQueue.k !== null && GlobalQueue.k(e);
|
|
75
76
|
notifyMarkBoundaries(e);
|
|
76
77
|
schedule();
|
|
77
78
|
}
|
|
@@ -85,8 +86,8 @@ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
|
|
|
85
86
|
shiftAffectsMarks(-1);
|
|
86
87
|
e.o.t--;
|
|
87
88
|
if (!e.o.t) {
|
|
88
|
-
GlobalQueue.
|
|
89
|
-
GlobalQueue.
|
|
89
|
+
GlobalQueue.k !== null && GlobalQueue.k(e, true);
|
|
90
|
+
GlobalQueue.p?.(e);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
@@ -103,11 +104,11 @@ import { $TARGET, getStoreAffectsNodes } from "./store/store.js";
|
|
|
103
104
|
// Each call site is gated by state only this module creates (a non-empty
|
|
104
105
|
// `_affectsNodes` batch, a live scope in the store's `affectsScopes`), so the
|
|
105
106
|
// hooks are installed before the first time any of them can fire.
|
|
106
|
-
GlobalQueue.
|
|
107
|
+
GlobalQueue.G = releaseAffectsMarks;
|
|
107
108
|
|
|
108
|
-
GlobalQueue.
|
|
109
|
+
GlobalQueue.M = markAffects;
|
|
109
110
|
|
|
110
|
-
GlobalQueue.
|
|
111
|
+
GlobalQueue.N = releaseAffectsMark;
|
|
111
112
|
|
|
112
113
|
function affects(e, r) {
|
|
113
114
|
const t = e?.[$TARGET];
|
package/dist/prod/boundaries.js
CHANGED
|
@@ -22,7 +22,7 @@ function boundaryComputed(e, t) {
|
|
|
22
22
|
const r = computed(e, {
|
|
23
23
|
lazy: true
|
|
24
24
|
});
|
|
25
|
-
ext(r).
|
|
25
|
+
ext(r).h = (e, t) => {
|
|
26
26
|
// Use passed values if provided, otherwise read from node
|
|
27
27
|
const n = e !== undefined ? e : r.S;
|
|
28
28
|
const s = t !== undefined ? t : r.o?._;
|
|
@@ -80,18 +80,18 @@ function isRevealController(e) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function isSlotReady(e) {
|
|
83
|
-
return isRevealController(e) ? e.O() : e.v.size === 0 && !e.
|
|
83
|
+
return isRevealController(e) ? e.O() : e.v.size === 0 && !e.U;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function isSlotMinimallyReady(e) {
|
|
87
|
-
return isRevealController(e) ? e.
|
|
87
|
+
return isRevealController(e) ? e.I() : isSlotReady(e);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function setSlotState(e, t, r, n) {
|
|
91
|
-
setSignal(e.
|
|
92
|
-
setSignal(e.
|
|
91
|
+
setSignal(e.D, r);
|
|
92
|
+
setSignal(e.P, n);
|
|
93
93
|
if (isRevealController(e)) {
|
|
94
|
-
if (!r && e.
|
|
94
|
+
if (!r && e.j === t) e.j = undefined;
|
|
95
95
|
return e.B(r, n);
|
|
96
96
|
}
|
|
97
97
|
if (!r && e.W === t && e.L) e.W = undefined;
|
|
@@ -101,12 +101,12 @@ class RevealController {
|
|
|
101
101
|
F;
|
|
102
102
|
q;
|
|
103
103
|
V=[];
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
j;
|
|
105
|
+
D=signal(false, {
|
|
106
106
|
ownedWrite: true,
|
|
107
107
|
H: true
|
|
108
108
|
});
|
|
109
|
-
|
|
109
|
+
P=signal(false, {
|
|
110
110
|
ownedWrite: true,
|
|
111
111
|
H: true
|
|
112
112
|
});
|
|
@@ -120,7 +120,7 @@ class RevealController {
|
|
|
120
120
|
Y(e) {
|
|
121
121
|
for (let t = 0; t < this.V.length; t++) {
|
|
122
122
|
const r = this.V[t];
|
|
123
|
-
if ((isRevealController(r) ? r.
|
|
123
|
+
if ((isRevealController(r) ? r.j : r.W) !== this) continue;
|
|
124
124
|
if (e(r) === false) return false;
|
|
125
125
|
}
|
|
126
126
|
return true;
|
|
@@ -134,7 +134,7 @@ class RevealController {
|
|
|
134
134
|
* - `together`: every direct slot is minimally ready.
|
|
135
135
|
* - `sequential`: the first owned slot is minimally ready (frontier can advance).
|
|
136
136
|
* - `natural`: any owned slot is minimally ready.
|
|
137
|
-
*/
|
|
137
|
+
*/ I() {
|
|
138
138
|
const e = untrack(this.F);
|
|
139
139
|
if (e === "together") return this.Y(isSlotMinimallyReady);
|
|
140
140
|
if (e === "natural") {
|
|
@@ -161,7 +161,7 @@ class RevealController {
|
|
|
161
161
|
if (this.V.includes(e)) return;
|
|
162
162
|
this.V.push(e);
|
|
163
163
|
const t = untrack(this.F);
|
|
164
|
-
setSignal(e.
|
|
164
|
+
setSignal(e.D, true), setSignal(e.P, t === "sequential" ? !!untrack(this.q) : false);
|
|
165
165
|
untrack(() => this.B());
|
|
166
166
|
}
|
|
167
167
|
$(e) {
|
|
@@ -175,7 +175,7 @@ class RevealController {
|
|
|
175
175
|
const r = this.J;
|
|
176
176
|
const n = this.K;
|
|
177
177
|
try {
|
|
178
|
-
const r = e ?? read(this.
|
|
178
|
+
const r = e ?? read(this.D), n = untrack(this.F), s = n === "sequential" && !!untrack(this.q), i = t ?? s;
|
|
179
179
|
if (r) {
|
|
180
180
|
// Held by an outer group. Propagate the hold (and whatever collapsed policy
|
|
181
181
|
// the outer asked for) down the whole subtree. Inner order is ignored while
|
|
@@ -187,8 +187,8 @@ class RevealController {
|
|
|
187
187
|
// so the parent backpointer survives for upward readiness notifications.
|
|
188
188
|
this.Y(e => {
|
|
189
189
|
if (isRevealController(e)) {
|
|
190
|
+
setSignal(e.P, false);
|
|
190
191
|
setSignal(e.D, false);
|
|
191
|
-
setSignal(e.I, false);
|
|
192
192
|
e.B(false, false);
|
|
193
193
|
} else {
|
|
194
194
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
@@ -215,8 +215,8 @@ class RevealController {
|
|
|
215
215
|
// advancing past this slot, and we bypass setSlotState so the parent
|
|
216
216
|
// backpointer survives for upward readiness notifications.
|
|
217
217
|
if (isRevealController(t)) {
|
|
218
|
+
setSignal(t.P, false);
|
|
218
219
|
setSignal(t.D, false);
|
|
219
|
-
setSignal(t.I, false);
|
|
220
220
|
t.B(false, false);
|
|
221
221
|
} else {
|
|
222
222
|
setSlotState(t, this, true, false);
|
|
@@ -225,10 +225,10 @@ class RevealController {
|
|
|
225
225
|
}
|
|
226
226
|
} finally {
|
|
227
227
|
this.J = this.O();
|
|
228
|
-
this.K = this.
|
|
228
|
+
this.K = this.I();
|
|
229
229
|
this.X = false;
|
|
230
230
|
}
|
|
231
|
-
if (this.
|
|
231
|
+
if (this.j && (r !== this.J || n !== this.K)) this.j.B();
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
|
|
@@ -236,13 +236,13 @@ class CollectionQueue extends Queue {
|
|
|
236
236
|
ee;
|
|
237
237
|
v=new Set;
|
|
238
238
|
te;
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
U=true;
|
|
240
|
+
D=signal(false, {
|
|
241
241
|
ownedWrite: true,
|
|
242
242
|
H: true
|
|
243
243
|
});
|
|
244
244
|
_;
|
|
245
|
-
|
|
245
|
+
P=signal(false, {
|
|
246
246
|
ownedWrite: true,
|
|
247
247
|
H: true
|
|
248
248
|
});
|
|
@@ -255,7 +255,7 @@ class CollectionQueue extends Queue {
|
|
|
255
255
|
this.ee = e;
|
|
256
256
|
}
|
|
257
257
|
run(e) {
|
|
258
|
-
if (!e || read(this.
|
|
258
|
+
if (!e || read(this.D) && (!_revealUsed || read(this.P))) return;
|
|
259
259
|
return super.run(e);
|
|
260
260
|
}
|
|
261
261
|
notify(e, t, r, n) {
|
|
@@ -286,12 +286,12 @@ class CollectionQueue extends Queue {
|
|
|
286
286
|
// (the Loading > Errored > content composition escape, #2856).
|
|
287
287
|
if (this.ee & STATUS_PENDING && this.L) return super.notify(e, t, r, n);
|
|
288
288
|
if (r & this.ee) {
|
|
289
|
-
this.
|
|
289
|
+
this.U = true;
|
|
290
290
|
const t = n?.source || e.o?._?.source;
|
|
291
291
|
if (t) {
|
|
292
292
|
const e = this.v.size === 0;
|
|
293
293
|
this.v.add(t);
|
|
294
|
-
if (e) setSignal(this.
|
|
294
|
+
if (e) setSignal(this.D, true);
|
|
295
295
|
if (this.ee & STATUS_ERROR) {
|
|
296
296
|
setSignal(this._, unwrapStatusError(t.o?._));
|
|
297
297
|
}
|
|
@@ -309,13 +309,13 @@ class CollectionQueue extends Queue {
|
|
|
309
309
|
if (e.ie & REACTIVE_DISPOSED || !e.o?.t && !(e.S & this.ee) && !(this.ee & STATUS_ERROR && e.S & STATUS_PENDING)) this.v.delete(e);
|
|
310
310
|
}
|
|
311
311
|
if (!this.v.size) {
|
|
312
|
-
if (this.ee & STATUS_PENDING && this.
|
|
313
|
-
this.
|
|
312
|
+
if (this.ee & STATUS_PENDING && this.U && !this.L && this.te) {
|
|
313
|
+
this.U = !!(this.te.S & this.ee);
|
|
314
314
|
} else {
|
|
315
|
-
this.
|
|
315
|
+
this.U = false;
|
|
316
316
|
}
|
|
317
|
-
if (!this.
|
|
318
|
-
setSignal(this.
|
|
317
|
+
if (!this.U) {
|
|
318
|
+
setSignal(this.D, false);
|
|
319
319
|
if (this.re) {
|
|
320
320
|
try {
|
|
321
321
|
this.ne = untrack(() => this.re());
|
|
@@ -346,7 +346,7 @@ function createCollectionBoundary(e, t, r, n) {
|
|
|
346
346
|
} catch (e) {
|
|
347
347
|
if (e instanceof NotReadyError) t = true; else throw e;
|
|
348
348
|
}
|
|
349
|
-
i.
|
|
349
|
+
i.U = t || !!(o.S & e) || o.o?._ instanceof NotReadyError;
|
|
350
350
|
});
|
|
351
351
|
const l = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
352
352
|
if (l) {
|
|
@@ -355,14 +355,14 @@ function createCollectionBoundary(e, t, r, n) {
|
|
|
355
355
|
cleanup(() => l.$(i));
|
|
356
356
|
}
|
|
357
357
|
return accessor(computed(() => {
|
|
358
|
-
if (!read(i.
|
|
358
|
+
if (!read(i.D)) {
|
|
359
359
|
const e = read(o);
|
|
360
|
-
if (!untrack(() => read(i.
|
|
360
|
+
if (!untrack(() => read(i.D))) return i.L = true, e;
|
|
361
361
|
}
|
|
362
362
|
// Collapsed reveal slots suppress their own output entirely; the
|
|
363
363
|
// renderer treats the hole as empty, so the cast never leaks to users
|
|
364
364
|
// outside a `createRevealOrder` scope.
|
|
365
|
-
if (_revealUsed && read(i.
|
|
365
|
+
if (_revealUsed && read(i.P)) return undefined;
|
|
366
366
|
return r(i);
|
|
367
367
|
},
|
|
368
368
|
// Boundary structure, not a user source: its value is fallback-or-content and
|
|
@@ -424,7 +424,12 @@ function createCollectionBoundary(e, t, r, n) {
|
|
|
424
424
|
* ```
|
|
425
425
|
*/ function createErrorBoundary(e, t) {
|
|
426
426
|
return createCollectionBoundary(STATUS_ERROR, e, e => t(accessor(e._), () => {
|
|
427
|
-
for (const t of e.v)
|
|
427
|
+
for (const t of e.v) {
|
|
428
|
+
// Non-computed sources (patch-channel registrations under plain
|
|
429
|
+
// owners) are not recomputable — their reset is the record's next
|
|
430
|
+
// transition re-applying the patch (re-audit 2, P1-4).
|
|
431
|
+
if (t.oe !== undefined) recompute(t);
|
|
432
|
+
}
|
|
428
433
|
schedule();
|
|
429
434
|
}));
|
|
430
435
|
}
|
|
@@ -484,7 +489,7 @@ function createCollectionBoundary(e, t, r, n) {
|
|
|
484
489
|
o.B();
|
|
485
490
|
});
|
|
486
491
|
if (n) {
|
|
487
|
-
o.
|
|
492
|
+
o.j = n;
|
|
488
493
|
n.Z(o);
|
|
489
494
|
cleanup(() => n.$(o));
|
|
490
495
|
}
|
package/dist/prod/core/action.js
CHANGED
|
@@ -78,11 +78,11 @@ function restoreTransition(e, r) {
|
|
|
78
78
|
const i = e(...r);
|
|
79
79
|
globalQueue.initTransition();
|
|
80
80
|
let o = activeTransition;
|
|
81
|
-
o.
|
|
81
|
+
o.ue.push(i);
|
|
82
82
|
const done = (e, r, u = false) => {
|
|
83
83
|
o = currentTransition(o);
|
|
84
|
-
const s = o.
|
|
85
|
-
if (s >= 0) o.
|
|
84
|
+
const s = o.ue.indexOf(i);
|
|
85
|
+
if (s >= 0) o.ue.splice(s, 1);
|
|
86
86
|
// Re-adopt through initTransition like every other resumption site:
|
|
87
87
|
// a bare setActiveTransition leaves globalQueue._batch as a detached
|
|
88
88
|
// ambient batch, and anything registered before the scheduled flush
|
package/dist/prod/core/async.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { STATUS_UNINITIALIZED, CONFIG_CHILD_COMPANIONS, STATUS_ERROR, STATUS_PENDING, REACTIVE_DIRTY, REACTIVE_OPTIMISTIC_DIRTY, NOT_PENDING, CONFIG_AUTO_DISPOSE, REACTIVE_ZOMBIE, REACTIVE_DISPOSED } from "./constants.js";
|
|
2
2
|
|
|
3
|
-
import { untrack, ext, setSignal, context } from "./core.js";
|
|
3
|
+
import { untrack, ext, statusNotifierOf, setSignal, context } from "./core.js";
|
|
4
4
|
|
|
5
5
|
import "./invariants.js";
|
|
6
6
|
|
|
@@ -45,7 +45,7 @@ function clearPendingSources(e) {
|
|
|
45
45
|
* with NO read-visible pending status, no downstream propagation, no
|
|
46
46
|
* transition, no lane registration. Commit #0 keeps serving.
|
|
47
47
|
*/ function parkLoadingWindow(e, n) {
|
|
48
|
-
ext(e).
|
|
48
|
+
ext(e).fe = true;
|
|
49
49
|
if (n.source) addPendingSource(e, n.source);
|
|
50
50
|
// A settled error is the node's answer ("the error stays the answer until
|
|
51
51
|
// this retry can actually run") — the park must not replace it: reads
|
|
@@ -70,10 +70,10 @@ function setPendingError(e, n, t) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function forEachDependent(e, n) {
|
|
73
|
-
for (let t = e.u; t !== null; t = t.
|
|
73
|
+
for (let t = e.u; t !== null; t = t.ae) n(t.ce, t);
|
|
74
74
|
// `?? null`: affects() marks route plain signals (no `_child` slot) through here.
|
|
75
|
-
for (let t = e.o?.
|
|
76
|
-
for (let e = t.u; e !== null; e = e.
|
|
75
|
+
for (let t = e.o?.i ?? null; t !== null; t = t.Se) {
|
|
76
|
+
for (let e = t.u; e !== null; e = e.ae) n(e.ce, e);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -88,7 +88,7 @@ function forEachDependent(e, n) {
|
|
|
88
88
|
// callbacks handle their own release (settleAutodispose in handleAsync); this
|
|
89
89
|
// covers derivatively-pending dependents, which have no callbacks of their own.
|
|
90
90
|
function releaseIfSettledUnobserved(e) {
|
|
91
|
-
e.
|
|
91
|
+
e.oe && e.T & CONFIG_AUTO_DISPOSE && !e.u && !(e.ie & REACTIVE_ZOMBIE) && !(e.S & STATUS_PENDING) && unobserved(e);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// Error-path sweep: notifyStatus(STATUS_ERROR) clears dependents' pending
|
|
@@ -149,25 +149,25 @@ function settlePendingSource(e) {
|
|
|
149
149
|
if (r.has(l) || !removePendingSource(l, e)) return;
|
|
150
150
|
r.add(l);
|
|
151
151
|
l.Te = clock;
|
|
152
|
-
const
|
|
152
|
+
const i = l.o?.le?.values().next().value;
|
|
153
153
|
// STATUS_ERROR + pending sources only coexist via an errored loading
|
|
154
154
|
// window's park (notifyStatus(STATUS_ERROR) clears pending sources
|
|
155
155
|
// otherwise): the settled error stays the answer through the settle —
|
|
156
156
|
// nulling it here would have reads throw `null` until the re-enqueued
|
|
157
157
|
// retry lands, or lose it entirely if that retry parks again (#2989).
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
if (!
|
|
158
|
+
const u = l.S & STATUS_ERROR;
|
|
159
|
+
if (i) {
|
|
160
|
+
if (!u) setPendingError(l, i);
|
|
161
161
|
o !== null && o(l);
|
|
162
162
|
} else {
|
|
163
163
|
l.S &= ~STATUS_PENDING;
|
|
164
|
-
if (!
|
|
164
|
+
if (!u) setPendingError(l);
|
|
165
165
|
o !== null && o(l);
|
|
166
|
-
if (l.o?.
|
|
166
|
+
if (l.o?.fe) {
|
|
167
167
|
enqueueSub(l);
|
|
168
168
|
n = true;
|
|
169
169
|
}
|
|
170
|
-
if (l.o !== null) l.o.
|
|
170
|
+
if (l.o !== null) l.o.fe = false;
|
|
171
171
|
// Fully settled with nobody watching: release candidate (#2934). Checked
|
|
172
172
|
// again at release time — deferred so unobserved() can't unlink subs
|
|
173
173
|
// lists this walk is still iterating.
|
|
@@ -256,8 +256,8 @@ function handleAsync(e, n, t) {
|
|
|
256
256
|
const l = !!(e.S & STATUS_UNINITIALIZED);
|
|
257
257
|
trimStaleDeps(e);
|
|
258
258
|
clearStatus(e);
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
259
|
+
const i = resolveLane(e);
|
|
260
|
+
if (i) i.Ae.delete(e);
|
|
261
261
|
if (t) {
|
|
262
262
|
t(r);
|
|
263
263
|
if (l) clearStatus(e, true);
|
|
@@ -285,7 +285,7 @@ function handleAsync(e, n, t) {
|
|
|
285
285
|
insertSubs(e);
|
|
286
286
|
}
|
|
287
287
|
e.Te = clock;
|
|
288
|
-
} else if (
|
|
288
|
+
} else if (i) {
|
|
289
289
|
// Route through lane's effect queue for independent flushing
|
|
290
290
|
const n = e.Re;
|
|
291
291
|
const t = e.be;
|
|
@@ -355,12 +355,12 @@ function handleAsync(e, n, t) {
|
|
|
355
355
|
// meaningful only in the live posture.
|
|
356
356
|
const consumeIterator = (t, r) => {
|
|
357
357
|
const o = t[Symbol.asyncIterator]();
|
|
358
|
-
let u = false;
|
|
359
358
|
let i = false;
|
|
359
|
+
let u = false;
|
|
360
360
|
let s = !r;
|
|
361
361
|
const close = () => {
|
|
362
|
-
if (
|
|
363
|
-
|
|
362
|
+
if (u) return;
|
|
363
|
+
u = true;
|
|
364
364
|
try {
|
|
365
365
|
const e = o.return?.();
|
|
366
366
|
if (isThenable(e)) e.then(undefined, () => {});
|
|
@@ -395,15 +395,15 @@ function handleAsync(e, n, t) {
|
|
|
395
395
|
if (c && s) {
|
|
396
396
|
t = r;
|
|
397
397
|
f = true;
|
|
398
|
-
if (r.done)
|
|
398
|
+
if (r.done) u = true;
|
|
399
399
|
} else if (e.o?.Ee !== n) {
|
|
400
400
|
return;
|
|
401
401
|
} else if (!r.done) {
|
|
402
|
-
|
|
402
|
+
i = true;
|
|
403
403
|
asyncWrite(r.value, iterateOrRelease);
|
|
404
404
|
} else {
|
|
405
|
-
|
|
406
|
-
if (
|
|
405
|
+
u = true;
|
|
406
|
+
if (i) {
|
|
407
407
|
schedule();
|
|
408
408
|
flush();
|
|
409
409
|
} else {
|
|
@@ -417,7 +417,7 @@ function handleAsync(e, n, t) {
|
|
|
417
417
|
r = t;
|
|
418
418
|
a = true;
|
|
419
419
|
} else if (e.o?.Ee === n) {
|
|
420
|
-
|
|
420
|
+
u = true;
|
|
421
421
|
handleError(t);
|
|
422
422
|
settleAutodispose();
|
|
423
423
|
}
|
|
@@ -425,14 +425,14 @@ function handleAsync(e, n, t) {
|
|
|
425
425
|
c = false;
|
|
426
426
|
if (a) {
|
|
427
427
|
// Match the promise branch, but only rethrow during the initial read.
|
|
428
|
-
|
|
428
|
+
u = true;
|
|
429
429
|
handleError(r);
|
|
430
430
|
if (s) throw r;
|
|
431
431
|
return true;
|
|
432
432
|
}
|
|
433
433
|
if (f && !t.done) {
|
|
434
434
|
l = t.value;
|
|
435
|
-
|
|
435
|
+
i = true;
|
|
436
436
|
return iterate();
|
|
437
437
|
}
|
|
438
438
|
return f && t.done;
|
|
@@ -440,12 +440,12 @@ function handleAsync(e, n, t) {
|
|
|
440
440
|
const f = iterate();
|
|
441
441
|
// Later iterate() calls run from asyncWrite, where rethrowing would be unhandled.
|
|
442
442
|
s = false;
|
|
443
|
-
return
|
|
443
|
+
return i || f;
|
|
444
444
|
};
|
|
445
445
|
// Landed-synchronously verdict for a LIVE iterator drain; null when no live
|
|
446
446
|
// drain ran (plain promise flight, or a deferred flatten). Drives the
|
|
447
447
|
// shared NotReady/loading tail below.
|
|
448
|
-
let
|
|
448
|
+
let i = null;
|
|
449
449
|
// Flatten one async level: a thenable that RESOLVES to an AsyncIterable —
|
|
450
450
|
// the shape every async stub returning a stream produces — consumes as the
|
|
451
451
|
// stream itself rather than settling on the iterable object. One level
|
|
@@ -460,11 +460,11 @@ function handleAsync(e, n, t) {
|
|
|
460
460
|
}
|
|
461
461
|
if (!t) return false;
|
|
462
462
|
const r = consumeIterator(e, n);
|
|
463
|
-
if (!n)
|
|
463
|
+
if (!n) i = r;
|
|
464
464
|
return true;
|
|
465
465
|
};
|
|
466
466
|
if (o) {
|
|
467
|
-
let t = false, r = false, o,
|
|
467
|
+
let t = false, r = false, o, i = true;
|
|
468
468
|
// Close registration for the flattening path. Consumption starts in a
|
|
469
469
|
// microtask where the ambient owner is gone (or worse, someone else's),
|
|
470
470
|
// so `cleanup()` can't be used — the close targets el's disposal list
|
|
@@ -479,7 +479,7 @@ function handleAsync(e, n, t) {
|
|
|
479
479
|
if (!e.he) e.he = n; else if (Array.isArray(e.he)) e.he.push(n); else e.he = [ e.he, n ];
|
|
480
480
|
};
|
|
481
481
|
n.then(r => {
|
|
482
|
-
if (
|
|
482
|
+
if (i) {
|
|
483
483
|
l = r;
|
|
484
484
|
t = true;
|
|
485
485
|
} else if (e.o?.Ee === n && !(e.ie & REACTIVE_DISPOSED) && flattenIfIterable(r, registerDeferredClose)) ; else {
|
|
@@ -487,7 +487,7 @@ function handleAsync(e, n, t) {
|
|
|
487
487
|
settleAutodispose();
|
|
488
488
|
}
|
|
489
489
|
}, e => {
|
|
490
|
-
if (
|
|
490
|
+
if (i) {
|
|
491
491
|
o = e;
|
|
492
492
|
r = true;
|
|
493
493
|
} else {
|
|
@@ -495,7 +495,7 @@ function handleAsync(e, n, t) {
|
|
|
495
495
|
settleAutodispose();
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
|
-
|
|
498
|
+
i = false;
|
|
499
499
|
if (r) {
|
|
500
500
|
// Settle through the same status path an async rejection uses, then
|
|
501
501
|
// unwind the in-progress synchronous read so the errored node isn't
|
|
@@ -519,8 +519,8 @@ function handleAsync(e, n, t) {
|
|
|
519
519
|
// apply and the shared tail below settles the verdict.
|
|
520
520
|
}
|
|
521
521
|
if (r) flattenIfIterable(n);
|
|
522
|
-
if (
|
|
523
|
-
if (!
|
|
522
|
+
if (i !== null) {
|
|
523
|
+
if (!i) {
|
|
524
524
|
// Loading window: serve commit #0 (see the promise branch above).
|
|
525
525
|
if (e.Ie) return e.be;
|
|
526
526
|
globalQueue.initTransition(resolveTransition(e));
|
|
@@ -535,7 +535,7 @@ function handleAsync(e, n, t) {
|
|
|
535
535
|
|
|
536
536
|
function clearStatus(e, n = false) {
|
|
537
537
|
if (e.o?.le) clearPendingSources(e);
|
|
538
|
-
if (e.o?.
|
|
538
|
+
if (e.o?.fe) if (e.o !== null) e.o.fe = false;
|
|
539
539
|
// The pending window is over; its quiet classification dies with it.
|
|
540
540
|
// (Unconditional: _reask is baked into the node literals, so this is a
|
|
541
541
|
// plain store to an existing slot — no shape change.)
|
|
@@ -545,17 +545,18 @@ function clearStatus(e, n = false) {
|
|
|
545
545
|
// Update pending signal for isPending() reactivity (companions only exist
|
|
546
546
|
// once the verdict layer created them, which installs the hooks).
|
|
547
547
|
if (e.o?.Ge || e.o?.ge) GlobalQueue.de(e);
|
|
548
|
-
if (e.o?.
|
|
549
|
-
|
|
548
|
+
if (e.o?.i && e.T & CONFIG_CHILD_COMPANIONS && GlobalQueue.ye !== null) GlobalQueue.ye(e);
|
|
549
|
+
const t = statusNotifierOf(e);
|
|
550
|
+
if (t) t.call(e);
|
|
550
551
|
}
|
|
551
552
|
|
|
552
553
|
function notifyStatus(e, n, t, r, o) {
|
|
553
554
|
// Wrap regular errors to track source node
|
|
554
555
|
if (n === STATUS_ERROR && !(t instanceof StatusError) && !(t instanceof NotReadyError)) t = new StatusError(e, t);
|
|
555
556
|
const l = n === STATUS_PENDING && t instanceof NotReadyError ? t.source : undefined;
|
|
556
|
-
const
|
|
557
|
-
const
|
|
558
|
-
const s =
|
|
557
|
+
const i = l === e;
|
|
558
|
+
const u = n === STATUS_PENDING && e.o?.De !== undefined && !i;
|
|
559
|
+
const s = u && hasActiveOverride(e);
|
|
559
560
|
if (!r) {
|
|
560
561
|
if (n === STATUS_PENDING && l) {
|
|
561
562
|
addPendingSource(e, l);
|
|
@@ -569,21 +570,22 @@ function notifyStatus(e, n, t, r, o) {
|
|
|
569
570
|
ext(e)._ = t;
|
|
570
571
|
}
|
|
571
572
|
GlobalQueue.de !== null && GlobalQueue.de(e);
|
|
572
|
-
if (e.o?.
|
|
573
|
+
if (e.o?.i && e.T & CONFIG_CHILD_COMPANIONS && GlobalQueue.ye !== null) GlobalQueue.ye(e);
|
|
573
574
|
}
|
|
574
575
|
if (o && !r) {
|
|
575
576
|
assignOrMergeLane(e, o);
|
|
576
577
|
}
|
|
577
578
|
const f = r || s;
|
|
578
|
-
const a = r ||
|
|
579
|
-
|
|
579
|
+
const a = r || u ? undefined : o;
|
|
580
|
+
const c = statusNotifierOf(e);
|
|
581
|
+
if (c) {
|
|
580
582
|
if (r && n === STATUS_PENDING) {
|
|
581
583
|
return;
|
|
582
584
|
}
|
|
583
585
|
if (f) {
|
|
584
|
-
|
|
586
|
+
c.call(e, n, t);
|
|
585
587
|
} else {
|
|
586
|
-
|
|
588
|
+
c.call(e);
|
|
587
589
|
}
|
|
588
590
|
return;
|
|
589
591
|
}
|