@solidjs/signals 2.0.0-rc.17 → 2.0.0-rc.19
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-shared.js +426 -241
- package/dist/dev.attribution.js +19 -16
- package/dist/dev.js +768 -409
- package/dist/observe/boundaries.js +88 -67
- package/dist/observe/core/action.js +8 -0
- package/dist/observe/core/async.js +183 -138
- package/dist/observe/core/attribution.js +30 -28
- package/dist/observe/core/constants.js +23 -1
- package/dist/observe/core/core.js +185 -157
- package/dist/observe/core/effect.js +34 -37
- package/dist/observe/core/graph.js +8 -8
- package/dist/observe/core/heap.js +5 -5
- package/dist/observe/core/lanes.js +104 -84
- package/dist/observe/core/owner.js +17 -16
- package/dist/observe/core/scheduler.js +61 -47
- package/dist/observe/core/truth.js +6 -6
- package/dist/observe/core/verdict.js +15 -15
- package/dist/observe/deferred.js +40 -38
- package/dist/observe/from.js +248 -0
- package/dist/observe/index.js +4 -2
- package/dist/observe/map.js +22 -22
- package/dist/observe/reveal.js +5 -5
- package/dist/observe/signals.js +57 -15
- package/dist/observe/store/affects.js +1 -1
- package/dist/observe/store/hooks.js +3 -0
- package/dist/observe/store/optimistic.js +11 -11
- package/dist/observe/store/projection.js +34 -21
- package/dist/observe/store/reconcile.js +138 -122
- package/dist/observe/store/store.js +628 -641
- package/dist/observe/store/target.js +1 -5
- package/dist/observe/store/utils.js +7 -2
- package/dist/prod/boundaries.js +153 -132
- package/dist/prod/core/action.js +8 -0
- package/dist/prod/core/async.js +242 -197
- package/dist/prod/core/constants.js +16 -1
- package/dist/prod/core/core.js +166 -138
- package/dist/prod/core/effect.js +31 -34
- package/dist/prod/core/graph.js +5 -5
- package/dist/prod/core/heap.js +12 -12
- package/dist/prod/core/lanes.js +98 -78
- package/dist/prod/core/owner.js +15 -14
- package/dist/prod/core/scheduler.js +64 -50
- package/dist/prod/core/truth.js +6 -6
- package/dist/prod/core/verdict.js +17 -17
- package/dist/prod/deferred.js +40 -38
- package/dist/prod/from.js +248 -0
- package/dist/prod/index.js +4 -2
- package/dist/prod/map.js +14 -14
- package/dist/prod/reveal.js +8 -8
- package/dist/prod/signals.js +46 -4
- package/dist/prod/store/affects.js +1 -1
- package/dist/prod/store/hooks.js +3 -0
- package/dist/prod/store/optimistic.js +16 -16
- package/dist/prod/store/projection.js +22 -9
- package/dist/prod/store/reconcile.js +138 -122
- package/dist/prod/store/store.js +308 -331
- package/dist/prod/store/target.js +13 -17
- package/dist/prod/store/utils.js +2 -0
- package/dist/types/core/action.d.ts +8 -0
- package/dist/types/core/async.d.ts +12 -2
- package/dist/types/core/constants.d.ts +25 -0
- package/dist/types/core/core.d.ts +33 -4
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +5 -1
- package/dist/types/core/scheduler.d.ts +17 -3
- package/dist/types/from.d.ts +47 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/signals.d.ts +37 -0
- package/dist/types/store/target.d.ts +2 -0
- package/package.json +1 -1
|
@@ -135,12 +135,12 @@ function setExternalHooks(e, n) {
|
|
|
135
135
|
En: [],
|
|
136
136
|
cn: null,
|
|
137
137
|
_parent: n,
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
P: e,
|
|
139
|
+
Pe: null,
|
|
140
140
|
tt: 0,
|
|
141
141
|
nt: false,
|
|
142
142
|
en: null,
|
|
143
|
-
|
|
143
|
+
ge: false,
|
|
144
144
|
ln: false,
|
|
145
145
|
I: null
|
|
146
146
|
};
|
|
@@ -227,7 +227,7 @@ function resolveTx(e) {
|
|
|
227
227
|
// into the other would close a cycle `resolveTx` never leaves.
|
|
228
228
|
e = resolveTx(e);
|
|
229
229
|
n = resolveTx(n);
|
|
230
|
-
if (e === n || e.
|
|
230
|
+
if (e === n || e.P || n.P) return;
|
|
231
231
|
e.cn = n;
|
|
232
232
|
n.tt += e.tt;
|
|
233
233
|
n.nt ||= e.nt;
|
|
@@ -311,7 +311,7 @@ function blockedBy(e, n, o = false) {
|
|
|
311
311
|
// lane-membership ruling, 2026-10-05). An output that never committed
|
|
312
312
|
// shows nothing — a mount the frame has not revealed — and holds
|
|
313
313
|
// nothing.
|
|
314
|
-
if ((o.i === EFFECT_RENDER && o.m & STATUS_PENDING || o.R & REACTIVE_FRAME_READ || o.l & CONFIG_REDERIVE && o.m === STATUS_PENDING) && (e.
|
|
314
|
+
if ((o.i === EFFECT_RENDER && o.m & STATUS_PENDING || o.R & REACTIVE_FRAME_READ || o.l & CONFIG_REDERIVE && o.m === STATUS_PENDING) && (e.de === o.Ne || o.T?.U != null) && !(o.R & REACTIVE_DISPOSED) && onScreen(o, judge ?? n)) return true;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return false;
|
|
@@ -389,8 +389,8 @@ function deferZombie(e) {
|
|
|
389
389
|
* next read of it trips over (`laneRead` → `txOf`). Its frame is the lane's
|
|
390
390
|
* too (ruling A: a lane pass's children are the lane's), revealed and
|
|
391
391
|
* retired at the lane's seam. */ function holdFrame(e, n) {
|
|
392
|
-
for (let o = e.
|
|
393
|
-
if (o.T?.Re?.
|
|
392
|
+
for (let o = e.pe; o !== null; o = o.Ge) {
|
|
393
|
+
if (o.T?.Re?.P) continue;
|
|
394
394
|
if (o.X !== undefined) {
|
|
395
395
|
if (!(o.l & CONFIG_HELD)) holdNode(o, n);
|
|
396
396
|
o.l |= CONFIG_HELD_FRAME;
|
|
@@ -401,7 +401,7 @@ function deferZombie(e) {
|
|
|
401
401
|
|
|
402
402
|
/** The nodes under `owner` a transaction other than `t` holds (boundaries.ts:
|
|
403
403
|
* what an earlier hold staged under a re-armed boundary). */ function heldUnder(e, n, o) {
|
|
404
|
-
for (let t = e.
|
|
404
|
+
for (let t = e.pe; t !== null; t = t.Ge) {
|
|
405
405
|
if ((t.l & (CONFIG_HELD | CONFIG_OVERRIDE)) === CONFIG_HELD && txOf(t) !== n) o(t);
|
|
406
406
|
heldUnder(t, n, o);
|
|
407
407
|
}
|
|
@@ -415,7 +415,7 @@ function deferZombie(e) {
|
|
|
415
415
|
const dirtyQueue = {
|
|
416
416
|
$e: new Array(2e3).fill(undefined),
|
|
417
417
|
p: false,
|
|
418
|
-
|
|
418
|
+
Fe: 0,
|
|
419
419
|
et: 0
|
|
420
420
|
};
|
|
421
421
|
|
|
@@ -497,12 +497,14 @@ function schedule() {
|
|
|
497
497
|
* hook machinery (pay-for-use).
|
|
498
498
|
*/ const ROOT_ERROR_HOOK = Symbol.for("solid-js/root-error-hook");
|
|
499
499
|
|
|
500
|
+
const HALTED = "[REACTIVITY_HALTED]";
|
|
501
|
+
|
|
500
502
|
function haltReactivity(e) {
|
|
501
503
|
if (halted) return;
|
|
502
504
|
halted = true;
|
|
503
505
|
// A cleanup error collected before the halt is dropped (owner.ts).
|
|
504
506
|
rethrowCleanupError(true);
|
|
505
|
-
let n =
|
|
507
|
+
let n = HALTED;
|
|
506
508
|
// Surface the cause here too: callers rethrow it, but a creation-time throw
|
|
507
509
|
// unwinds through ancestor recomputes that convert it to status instead of
|
|
508
510
|
// surfacing it (#2884), so the rethrow alone cannot guarantee visibility.
|
|
@@ -530,7 +532,7 @@ function haltReactivity(e) {
|
|
|
530
532
|
function notifyHalted() {
|
|
531
533
|
if (haltNotified) return;
|
|
532
534
|
haltNotified = true;
|
|
533
|
-
console.error(
|
|
535
|
+
console.error(HALTED);
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
/** @internal Test/dev-reload hook. Revives scheduling after a halt. */ function resetErrorHalt() {
|
|
@@ -561,7 +563,7 @@ class GlobalQueue {
|
|
|
561
563
|
clock++;
|
|
562
564
|
// A write the commit sweep staged with no subscriber to dirty is work
|
|
563
565
|
// too — the next round commits it.
|
|
564
|
-
scheduled = dirtyQueue.et >= dirtyQueue.
|
|
566
|
+
scheduled = dirtyQueue.et >= dirtyQueue.Fe || pendingNodes.length !== 0;
|
|
565
567
|
this.run(EFFECT_RENDER);
|
|
566
568
|
this.run(EFFECT_USER);
|
|
567
569
|
if (false && holding) ;
|
|
@@ -593,7 +595,7 @@ class GlobalQueue {
|
|
|
593
595
|
// A lane's own flush (its flight landing, its reveal) parks nothing: the
|
|
594
596
|
// lane's work reached it per pass; the frame's plain writes commit.
|
|
595
597
|
// (Resolved: a guess over another transaction's guess merged them.)
|
|
596
|
-
const n = e !== null && !e.
|
|
598
|
+
const n = e !== null && !e.P ? resolveTx(e) : null;
|
|
597
599
|
if (n !== null) {
|
|
598
600
|
// `t._nodes` grows under the walk (holdFrame pushes); the bound is
|
|
599
601
|
// this flush's list, which does not.
|
|
@@ -603,7 +605,7 @@ class GlobalQueue {
|
|
|
603
605
|
// Already held: the pass that re-staged it joined its transaction,
|
|
604
606
|
// which is `t` (or merged into it). Lane work is the lane's (a
|
|
605
607
|
// pending mark propagated onto it queued it here too).
|
|
606
|
-
if (!(e.l & (CONFIG_HELD | CONFIG_OVERRIDE)) && (e.T === null || e.T.Re === null || !e.T.Re.
|
|
608
|
+
if (!(e.l & (CONFIG_HELD | CONFIG_OVERRIDE)) && (e.T === null || e.T.Re === null || !e.T.Re.P)) {
|
|
607
609
|
// A loading source — pending with nothing staged and no committed
|
|
608
610
|
// value (A16, A19 exc. 1: uninitialized is loading, not pending)
|
|
609
611
|
// that is not an observer — is nobody's frame: not held. Its
|
|
@@ -612,18 +614,18 @@ class GlobalQueue {
|
|
|
612
614
|
// stale stamp was the bridge that entangled unrelated updates
|
|
613
615
|
// with a never-resolving flight). Its observers are held and
|
|
614
616
|
// wait on its flight (`blocked`).
|
|
615
|
-
if (e.
|
|
617
|
+
if (e.ie === NOT_PENDING && e.m & STATUS_UNINITIALIZED && e.i !== EFFECT_RENDER) continue;
|
|
616
618
|
// A34 (2): a tick whose writes net to the committed value made no
|
|
617
619
|
// proposal (`setShow(false); setShow(true)` on a committed true) —
|
|
618
620
|
// not staged, not held, pends nothing; a later write to it is
|
|
619
621
|
// plain mainline. (A node already held stays held when written
|
|
620
622
|
// back: A34 (1).)
|
|
621
|
-
if (e.
|
|
623
|
+
if (e.ie !== NOT_PENDING && !(e.m & (STATUS_PENDING | STATUS_UNINITIALIZED)) && e.T?.Ue == null && e.T?.me == null &&
|
|
622
624
|
// The comparator last: a pass that created children (an object
|
|
623
625
|
// owning a fresh async memo, #4111) must not have it read them.
|
|
624
626
|
// A NotReady read there is a change (`isSame`).
|
|
625
|
-
isSame(e, e.
|
|
626
|
-
e.
|
|
627
|
+
isSame(e, e.le, e.ie)) {
|
|
628
|
+
e.ie = NOT_PENDING;
|
|
627
629
|
e.l &= ~CONFIG_STAGED;
|
|
628
630
|
continue;
|
|
629
631
|
}
|
|
@@ -648,7 +650,7 @@ class GlobalQueue {
|
|
|
648
650
|
// (Verdict readers exist only with the verdict engine installed.)
|
|
649
651
|
const o = deferredZombies.splice(0);
|
|
650
652
|
if (observeFlightHook) {
|
|
651
|
-
o.sort((e, n) => e.
|
|
653
|
+
o.sort((e, n) => e.he - n.he);
|
|
652
654
|
for (let e = 0; e < o.length; e++) if ((o[e].R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE)) === REACTIVE_ZOMBIE && o[e].l & CONFIG_VERDICT) recompute(o[e]);
|
|
653
655
|
}
|
|
654
656
|
// The unchanged passes' tails stay linked (A30, #3469): their inputs
|
|
@@ -662,7 +664,7 @@ class GlobalQueue {
|
|
|
662
664
|
// `recompute`'s own gates.
|
|
663
665
|
for (let e = 0; e < heldTrims.length; e++) {
|
|
664
666
|
const n = heldTrims[e];
|
|
665
|
-
if (n.T?.
|
|
667
|
+
if (n.T?.U == null && !n.Ae) trimStaleDeps(n);
|
|
666
668
|
}
|
|
667
669
|
}
|
|
668
670
|
// The list is the flush's either way. Reset only when there is something
|
|
@@ -677,11 +679,12 @@ class GlobalQueue {
|
|
|
677
679
|
// This flush's own runs, the lanes' reveals, and the landings' held runs
|
|
678
680
|
// are collected apart and ordered below.
|
|
679
681
|
const o = this.un;
|
|
680
|
-
const t =
|
|
682
|
+
const t = [ [], [] ];
|
|
681
683
|
// The passes that read this frame's stagings as the screen read held
|
|
682
684
|
// writes if it parked: the lane seam re-derives them on the committed
|
|
683
685
|
// world (a lane's runs wait this round).
|
|
684
686
|
if (laneSeamsHook) {
|
|
687
|
+
this.un = t;
|
|
685
688
|
laneSeamsHook(n !== null ? stagedReaders : null);
|
|
686
689
|
if (stagedReaders.length) stagedReaders.length = 0;
|
|
687
690
|
}
|
|
@@ -725,7 +728,7 @@ class GlobalQueue {
|
|
|
725
728
|
if (deferredZombies.length !== 0) {
|
|
726
729
|
// Survivors are the displayed frame of a held pass: they rerun for the
|
|
727
730
|
// live write, parents before children.
|
|
728
|
-
const e = deferredZombies.splice(0).sort((e, n) => e.
|
|
731
|
+
const e = deferredZombies.splice(0).sort((e, n) => e.he - n.he);
|
|
729
732
|
for (let n = 0; n < e.length; n++) {
|
|
730
733
|
if (!(e[n].R & REACTIVE_DISPOSED)) recompute(e[n]);
|
|
731
734
|
}
|
|
@@ -796,29 +799,32 @@ class GlobalQueue {
|
|
|
796
799
|
* or without the held read) owes nothing. A run this transaction stashed
|
|
797
800
|
* for it is void (#3322: an effect has one value slot, and the stale pass
|
|
798
801
|
* overwrote the value that run was for) — the re-derivation's run replaces
|
|
799
|
-
* it. */ function reruns(e) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
+
* it. Truthy when an effect re-derives (`land`). */ function reruns(e) {
|
|
803
|
+
let n;
|
|
804
|
+
for (let o = 0; o < e.En.length; o++) {
|
|
805
|
+
const t = e.En[o];
|
|
802
806
|
// An errored reader's display is its error (D-39): the landing gives it
|
|
803
807
|
// nothing to re-derive, and a re-run would be a read that retries the
|
|
804
808
|
// errored source (#3945).
|
|
805
|
-
if (
|
|
806
|
-
if (
|
|
807
|
-
|
|
808
|
-
|
|
809
|
+
if (t.R & REACTIVE_DISPOSED || t.m & STATUS_ERROR) continue;
|
|
810
|
+
if (t.R & REACTIVE_FRAME_READ || t.l & CONFIG_VERDICT) {
|
|
811
|
+
n ||= t.i;
|
|
812
|
+
t.R &= ~REACTIVE_FRAME_READ;
|
|
813
|
+
t.Ae = false;
|
|
809
814
|
// Its frame is replaced by the re-derivation: a run one of its
|
|
810
815
|
// children queued this flush (re-run by the same landing) is for the
|
|
811
816
|
// frame being replaced — void too (#3404).
|
|
812
|
-
for (let e =
|
|
813
|
-
enqueueSub(
|
|
817
|
+
for (let e = t.pe; e !== null; e = e.Ge) if (e.i) e.Ae = false;
|
|
818
|
+
enqueueSub(t);
|
|
814
819
|
}
|
|
815
820
|
}
|
|
816
821
|
e.En.length = 0;
|
|
822
|
+
return n;
|
|
817
823
|
}
|
|
818
824
|
|
|
819
825
|
/** The landing: the held frame becomes the frame. */ function land(e) {
|
|
820
|
-
reruns(e);
|
|
821
|
-
if (e.I !== null) releaseMarksHook(e.I);
|
|
826
|
+
const n = reruns(e);
|
|
827
|
+
if (releaseMarksHook && e.I !== null) releaseMarksHook(e.I);
|
|
822
828
|
// Old children die in the commits (cleanups first), then the stashed
|
|
823
829
|
// effects run ahead of this flush's own. A node a lane took over since
|
|
824
830
|
// (a guess written over the staged truth) is the lane's to land.
|
|
@@ -832,7 +838,15 @@ class GlobalQueue {
|
|
|
832
838
|
// `u`, which has left `transactions`: the write is this landing's, and
|
|
833
839
|
// the next flush must not park in it (#4089).
|
|
834
840
|
if (flushTransaction === e) flushTransaction = null;
|
|
835
|
-
|
|
841
|
+
// An effect re-derives next round (`reruns`): the held runs wait for it
|
|
842
|
+
// (D-9, the A15 reveal corollary, #4071). Its re-derivation can discover a
|
|
843
|
+
// flight — a stale reader whose mainline pass stopped reading it, now
|
|
844
|
+
// reading the landed world — and a landing that showed its runs first
|
|
845
|
+
// would reveal the held write beside a frame that can only show its old
|
|
846
|
+
// value. Queued last in this effect phase, the release hands them to the
|
|
847
|
+
// next round's own runs, ahead of the re-derivation's: they show with it,
|
|
848
|
+
// or park with it in the hold its pending opens. The commits stand.
|
|
849
|
+
if (n) globalQueue.un[1].push(() => releaseQueues(e)); else releaseQueues(e);
|
|
836
850
|
}
|
|
837
851
|
|
|
838
852
|
/** The held runs join this flush's effect phase after its own runs (the
|
|
@@ -888,7 +902,7 @@ function insertSubs(e) {
|
|
|
888
902
|
// masked read of the always-present _config instead of missing-property
|
|
889
903
|
// lookups in the hottest notify loop.
|
|
890
904
|
const n = e.l;
|
|
891
|
-
const o = (n & CONFIG_HAS_SNAPSHOT) !== 0 && e.T?.
|
|
905
|
+
const o = (n & CONFIG_HAS_SNAPSHOT) !== 0 && e.T?.De !== undefined;
|
|
892
906
|
for (let n = e.o; n !== null; n = n.t) {
|
|
893
907
|
const e = n.u;
|
|
894
908
|
// Missed-wake latch (#3037): this write is landing while the subscriber
|
|
@@ -899,7 +913,7 @@ function insertSubs(e) {
|
|
|
899
913
|
// pass either re-reads them fresh or trims them), and neither does the
|
|
900
914
|
// tail link: it is the read IN FLIGHT — read() links before it pulls, so
|
|
901
915
|
// this very commit is what that read returns.
|
|
902
|
-
if (e.R & REACTIVE_RECOMPUTING_DEPS && n.
|
|
916
|
+
if (e.R & REACTIVE_RECOMPUTING_DEPS && n.de === e.Ne && n !== e._) e.R |= REACTIVE_MISSED_WAKE;
|
|
903
917
|
if (o && e.l & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
904
918
|
e.R |= REACTIVE_SNAPSHOT_STALE;
|
|
905
919
|
continue;
|
|
@@ -918,7 +932,7 @@ function insertSubs(e) {
|
|
|
918
932
|
* (the lane-membership ruling, 2026-10-05; `_update`). */ function laneDirty(e, n) {
|
|
919
933
|
for (let o = e.o; o !== null; o = o.t) {
|
|
920
934
|
const e = o.u.T?.Re;
|
|
921
|
-
if (e?.
|
|
935
|
+
if (e?.P ? sameLane(e, n) : o.u.i) o.u.R |= REACTIVE_LANE_DIRTY;
|
|
922
936
|
}
|
|
923
937
|
}
|
|
924
938
|
|
|
@@ -935,32 +949,32 @@ function commitPendingNode(e) {
|
|
|
935
949
|
// commits a value.
|
|
936
950
|
if (!n.X) {
|
|
937
951
|
e.l &= -385;
|
|
938
|
-
if (e.
|
|
939
|
-
e.
|
|
940
|
-
e.
|
|
952
|
+
if (e.ie !== NOT_PENDING) {
|
|
953
|
+
e.le = e.ie;
|
|
954
|
+
e.ie = NOT_PENDING;
|
|
941
955
|
}
|
|
942
956
|
return;
|
|
943
957
|
}
|
|
944
958
|
// Computeds only from here (`_statusFlags` is not a signal field). A
|
|
945
959
|
// commit beneath a flight publishes its inputs (A15 reveal corollary,
|
|
946
960
|
// #3305): a reveal of it must observe, not show the pre-flight value.
|
|
947
|
-
const o = e.
|
|
961
|
+
const o = e.ie === NOT_PENDING && (n.m & STATUS_PENDING) !== 0;
|
|
948
962
|
const t = e.l & CONFIG_STAGED_ERROR;
|
|
949
963
|
// An answer commits: the error it replaces leaves the display (D-41).
|
|
950
|
-
if (!o && n.T) n.T.
|
|
964
|
+
if (!o && n.T) n.T.Ie = undefined;
|
|
951
965
|
e.l = o ? e.l & -1048833 | CONFIG_INPUTS_PUBLISHED : e.l & -3147137;
|
|
952
966
|
// D-41: the staged answer is an error — published now, when a value would
|
|
953
967
|
// show, through the ordinary error path (`stageError`). Its readers first
|
|
954
968
|
// see it in the cycle after this seam: a tracked re-read there is not a
|
|
955
969
|
// retry (`read`), or a boundary re-derived by it would retry it forever.
|
|
956
970
|
if (t) {
|
|
957
|
-
const o = e.
|
|
958
|
-
e.
|
|
959
|
-
e.
|
|
971
|
+
const o = e.ie;
|
|
972
|
+
e.ie = NOT_PENDING;
|
|
973
|
+
e.Se = clock + 1;
|
|
960
974
|
notifyStatus(n, STATUS_ERROR, o);
|
|
961
|
-
} else if (e.
|
|
962
|
-
e.
|
|
963
|
-
e.
|
|
975
|
+
} else if (e.ie !== NOT_PENDING) {
|
|
976
|
+
e.le = e.ie;
|
|
977
|
+
e.ie = NOT_PENDING;
|
|
964
978
|
// A node born staged (recompute) initializes at this commit.
|
|
965
979
|
n.m &= ~STATUS_UNINITIALIZED;
|
|
966
980
|
// A quiet re-ask's classification survives its landing and dies with
|
|
@@ -986,7 +1000,7 @@ function commitPendingNode(e) {
|
|
|
986
1000
|
// pass or by the node's own landing (whose pass was clean), so a set
|
|
987
1001
|
// `_error` means the last pass threw, kept its full list, and `_depsTail`
|
|
988
1002
|
// marks where it stopped.
|
|
989
|
-
if (n.T?.
|
|
1003
|
+
if (n.T?.U == null) trimStaleDeps(n);
|
|
990
1004
|
if (!(n.m & STATUS_PENDING)) n.m &= ~STATUS_UNINITIALIZED;
|
|
991
1005
|
// L2: the children this commit publishes are the frame's now — the frame
|
|
992
1006
|
// they replace, parked by the pass (`recompute`), goes.
|
|
@@ -1040,4 +1054,4 @@ function runQueue(e, n) {
|
|
|
1040
1054
|
for (let o = 0; o < e.length; o++) e[o](n);
|
|
1041
1055
|
}
|
|
1042
1056
|
|
|
1043
|
-
export { GlobalQueue, MAINLINE_QUESTION, ROOT_ERROR_HOOK, actionDepth, applyGuessesHook, blocked, boundarySeamHook, bumpNotifyEpoch, catchHook, clock, commitPendingNode, deferZombie, dirtyQueue, endLanesHook, enforceLoadingBoundary, enterAction, exitAction, externalUntrackHook, flush, flushTransaction, freshHook, globalQueue, haltReactivity, haltReactivityAt, heldRunHook, heldTrim, heldUnder, hiddenHook, holdNode, insertSubs, installBoundaryHooks, installLaneHooks, installMarkHooks, installStoreHooks, installVerdictHooks, joinFuture, joinPassTx, laneCorrectionsHook, laneDirty, laneOutcomeHook, laneReadHook, laneSeamsHook, laneStageHook, laneWriteHook, lanesBlockedHook, list, liveTx, merge, newTransaction, nextQuestion, notifyEpoch, observeFlightHook, ownFlights, passLane, passTx, question, queuePendingNode, releaseAmbientMarksHook, releaseMarksHook, releaseQueues, reruns, resetErrorHalt, resolveTx, sameLane, schedule, setExternalHooks, setPassLane, setQuestion, stagedReaders, staleReader, storeCommitHook, storeParkHook, txOf, unhold, wireExternalSourceHook };
|
|
1057
|
+
export { GlobalQueue, MAINLINE_QUESTION, ROOT_ERROR_HOOK, actionDepth, applyGuessesHook, blocked, boundarySeamHook, bumpNotifyEpoch, catchHook, clock, commitPendingNode, deferZombie, dirtyQueue, endLanesHook, enforceLoadingBoundary, enterAction, exitAction, externalUntrackHook, flush, flushTransaction, freshHook, globalQueue, haltReactivity, haltReactivityAt, heldRunHook, heldTrim, heldUnder, hiddenHook, holdNode, insertSubs, installBoundaryHooks, installLaneHooks, installMarkHooks, installStoreHooks, installVerdictHooks, joinFuture, joinPassTx, laneCorrectionsHook, laneDirty, laneOutcomeHook, laneReadHook, laneSeamsHook, laneStageHook, laneWriteHook, lanesBlockedHook, list, liveTx, merge, newTransaction, nextQuestion, notifyEpoch, observeFlightHook, ownFlights, passLane, passTx, pendingNodes, question, queuePendingNode, releaseAmbientMarksHook, releaseMarksHook, releaseQueues, reruns, resetErrorHalt, resolveTx, sameLane, schedule, setExternalHooks, setPassLane, setQuestion, stagedReaders, staleReader, storeCommitHook, storeParkHook, txOf, unhold, wireExternalSourceHook };
|
package/dist/prod/core/truth.js
CHANGED
|
@@ -12,9 +12,9 @@ import { enqueueSub } from "./heap.js";
|
|
|
12
12
|
* staging a shown lane holds for its next reveal, else its slot; the
|
|
13
13
|
* committed value while it has none (its first lane pass in flight). */
|
|
14
14
|
function laneValueOf(r) {
|
|
15
|
-
if (!(r.l & CONFIG_GUESS) && r.
|
|
16
|
-
const t = r.T.
|
|
17
|
-
return t !== NOT_PENDING ? t : r.
|
|
15
|
+
if (!(r.l & CONFIG_GUESS) && r.ie !== NOT_PENDING) return r.ie;
|
|
16
|
+
const t = r.T.P;
|
|
17
|
+
return t !== NOT_PENDING ? t : r.le;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/** Truth readers (`until`, `refresh`; CONFIG_AUTHORITATIVE) — pay-for-use:
|
|
@@ -25,7 +25,7 @@ function laneValueOf(r) {
|
|
|
25
25
|
* value. */ function truthRead(r) {
|
|
26
26
|
if (truth(r)) return laneValueOf(r);
|
|
27
27
|
if (!(r.l & CONFIG_GUESS)) throw new NotReadyError(null);
|
|
28
|
-
return r.
|
|
28
|
+
return r.ie !== NOT_PENDING ? r.ie : r.le;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** A guess confirmed: its lane's truth readers re-read — of the lane's
|
|
@@ -36,8 +36,8 @@ function laneValueOf(r) {
|
|
|
36
36
|
/** A lane node's value is the truth when every guess beneath it is
|
|
37
37
|
* confirmed — its source staged a value equal to the guess — and nothing
|
|
38
38
|
* beneath it is held in the parent: same inputs, same value. */ function truth(r) {
|
|
39
|
-
if (r.l & CONFIG_GUESS) return r.
|
|
40
|
-
if (r.
|
|
39
|
+
if (r.l & CONFIG_GUESS) return r.ie !== NOT_PENDING && r.xe && r.xe(r.T.P, r.ie);
|
|
40
|
+
if (r.ie !== NOT_PENDING) return;
|
|
41
41
|
if (r.l & CONFIG_OVERRIDE) for (let t = r.C; t; t = t.G) if (!truth(t.S)) return;
|
|
42
42
|
return 1;
|
|
43
43
|
}
|
|
@@ -157,7 +157,7 @@ let probeFound = false;
|
|
|
157
157
|
* flight — a staging equal to what is displayed changes nothing when it
|
|
158
158
|
* lands: final now (maintainer, 2026-10-02). */ function heldNotFinal(e) {
|
|
159
159
|
if ((e.m & STATUS_PENDING) !== 0 && !quietPending(e)) return true;
|
|
160
|
-
return e.
|
|
160
|
+
return e.ie !== NOT_PENDING && !latestActive && !e.T.Ve && !(e.m & STATUS_UNINITIALIZED) && (!!e.T.Ie || !e.xe || !e.xe(e.le, e.ie));
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** `isPending`'s answer for an unheld node whose flight is up (cause ii). */ function pendingVerdict(e, t) {
|
|
@@ -256,8 +256,8 @@ let probeFound = false;
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
/** The staging, or the staged error thrown (D-41). */ function staged(e) {
|
|
259
|
-
if (e.l & CONFIG_STAGED_ERROR) throw e.
|
|
260
|
-
return e.
|
|
259
|
+
if (e.l & CONFIG_STAGED_ERROR) throw e.ie;
|
|
260
|
+
return e.ie;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/** `latest()` of a held node: the flushed staging — the proposal — and, for
|
|
@@ -317,11 +317,11 @@ let probeFound = false;
|
|
|
317
317
|
if (i) verdictRead(t, r._parent ?? r);
|
|
318
318
|
const u = (n.m & STATUS_PENDING) !== 0 && !quietPending(n);
|
|
319
319
|
if (e.l & CONFIG_GUESS) {
|
|
320
|
-
if (probing && (u || e.
|
|
320
|
+
if (probing && (u || e.ie !== NOT_PENDING && (!e.xe || !e.xe(e.T.P, e.ie)))) probeFound = true;
|
|
321
321
|
// A lane a correction folded under (D-34): `latest()` shows the hold's
|
|
322
322
|
// world whole — the truth beneath each guess, else what it covered.
|
|
323
323
|
if (latestActive && r.folded) return r.folded(null, e);
|
|
324
|
-
return e.T.
|
|
324
|
+
return e.T.P;
|
|
325
325
|
}
|
|
326
326
|
if (probing && u) probeFound = true;
|
|
327
327
|
return latestActive && !u ? laneValueOf(e) : display(e);
|
|
@@ -335,30 +335,30 @@ let probeFound = false;
|
|
|
335
335
|
// in flight — is a stale reader of the lane (#3460, as `laneRead`): the
|
|
336
336
|
// committed value now, re-derived at the reveal. Not inside a probe:
|
|
337
337
|
// `isPending` is answered below either way.
|
|
338
|
-
if (i && !probing && t.i === EFFECT_RENDER && passLane === null && r.
|
|
339
|
-
staleReader(t, r.
|
|
340
|
-
return e.
|
|
338
|
+
if (i && !probing && t.i === EFFECT_RENDER && passLane === null && r.Pe !== null && r.Pe.ln && flushTransaction !== r) {
|
|
339
|
+
staleReader(t, r.Pe);
|
|
340
|
+
return e.le;
|
|
341
341
|
}
|
|
342
342
|
if (i) verdictRead(t, r);
|
|
343
343
|
if (probing && heldNotFinal(n)) probeFound = true;
|
|
344
|
-
if (latestActive && e.
|
|
344
|
+
if (latestActive && e.ie !== NOT_PENDING) {
|
|
345
345
|
// An action body reading another transaction's proposal derives
|
|
346
346
|
// from it: the two settle as one (A15; posture C, 2026-09-15). An
|
|
347
347
|
// untracked read elsewhere has no transaction to entangle.
|
|
348
348
|
if (!i && flushTransaction !== null && !globalQueue.q) joinFuture(txOf(e));
|
|
349
349
|
return heldLatest(e, i ? t : null);
|
|
350
350
|
}
|
|
351
|
-
return e.
|
|
351
|
+
return e.le;
|
|
352
352
|
}
|
|
353
353
|
// Born into the future: its staging is its only value. It has no
|
|
354
354
|
// committed value, so no verdict: `isPending` reads it as its read does —
|
|
355
355
|
// the owner joins the hold (held with it, or caught by a boundary that
|
|
356
356
|
// has not shown content) and answers for the commit, where it is final.
|
|
357
|
-
if (e.
|
|
357
|
+
if (e.ie !== NOT_PENDING && !(n.m & STATUS_PENDING)) {
|
|
358
358
|
if (probing && r) joinPass(t, e);
|
|
359
359
|
return staged(e);
|
|
360
360
|
}
|
|
361
|
-
} else if (e.
|
|
361
|
+
} else if (e.ie !== NOT_PENDING) {
|
|
362
362
|
if (n.m & STATUS_PENDING && !u) pendingVerdict(i ? t : null, n); else if (i && globalQueue.q) provisionalVerdict(t, !latestActive && !u);
|
|
363
363
|
// Outside a flush, the staging is an unflushed write (A28): the probe
|
|
364
364
|
// answers for the flushed world, and watches the seam of the flush that
|
|
@@ -373,21 +373,21 @@ let probeFound = false;
|
|
|
373
373
|
if (globalQueue.q) return staged(e);
|
|
374
374
|
if (t !== null) markLateLinker(t);
|
|
375
375
|
}
|
|
376
|
-
return e.
|
|
376
|
+
return e.le;
|
|
377
377
|
}
|
|
378
378
|
if (n.m & STATUS_PENDING) {
|
|
379
379
|
if (!u) {
|
|
380
380
|
pendingVerdict(i ? t : null, n);
|
|
381
|
-
return e.
|
|
381
|
+
return e.le;
|
|
382
382
|
}
|
|
383
383
|
// As `read()`: an untracked read of a pending node still re-runs its
|
|
384
384
|
// reader when the node settles (a projection's pull reads its firewall
|
|
385
385
|
// untracked, store/store.ts).
|
|
386
386
|
if (t !== null && !tracking && !spectating && e !== t) link(e, t);
|
|
387
|
-
throw n.T?.
|
|
387
|
+
throw n.T?.U;
|
|
388
388
|
}
|
|
389
|
-
if (n.X !== undefined && n.m & STATUS_ERROR) throw n.T.
|
|
390
|
-
return e.
|
|
389
|
+
if (n.X !== undefined && n.m & STATUS_ERROR) throw n.T.U;
|
|
390
|
+
return e.le;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
// Installed at module evaluation — present exactly when something imports
|
package/dist/prod/deferred.js
CHANGED
|
@@ -121,7 +121,7 @@ GlobalQueue.er = e => lagging.size !== 0 ? lagOf(e, new Set) : undefined;
|
|
|
121
121
|
* does not replace (D-40) — restaged as the committed value, the hold's
|
|
122
122
|
* readers would re-derive against the old input. */ const serve = e => {
|
|
123
123
|
const r = handleAsync(t, e);
|
|
124
|
-
return t.l & CONFIG_HELD && t.
|
|
124
|
+
return t.l & CONFIG_HELD && t.ie !== NOT_PENDING ? t.ie : r;
|
|
125
125
|
};
|
|
126
126
|
const end = () => t.R & REACTIVE_DISPOSED && land(o);
|
|
127
127
|
return accessor(computed(r => {
|
|
@@ -133,49 +133,51 @@ GlobalQueue.er = e => lagging.size !== 0 ? lagOf(e, new Set) : undefined;
|
|
|
133
133
|
// Sticky, and read before this wrapper ever opens the window itself.
|
|
134
134
|
const n = l ||= !(t.m & STATUS_UNINITIALIZED) && !t.ce;
|
|
135
135
|
if (n) t.ce = true, t.l |= CONFIG_LAGS;
|
|
136
|
-
let c;
|
|
137
136
|
try {
|
|
138
|
-
|
|
137
|
+
const t = e(r);
|
|
138
|
+
if (n && typeof t === "object" && t !== null) {
|
|
139
|
+
if (isThenable(t)) {
|
|
140
|
+
ask(t);
|
|
141
|
+
const done = () => land(t, true);
|
|
142
|
+
t.then(done, done);
|
|
143
|
+
return serve(t);
|
|
144
|
+
}
|
|
145
|
+
const e = t[Symbol.asyncIterator];
|
|
146
|
+
if (e) {
|
|
147
|
+
// A stream's flight ends at its first yield (or its end).
|
|
148
|
+
const r = e.call(t);
|
|
149
|
+
let o = true;
|
|
150
|
+
const done = () => land(n, true);
|
|
151
|
+
const n = {
|
|
152
|
+
// Registered ahead of the engine's own reaction to the same
|
|
153
|
+
// promise, as for a plain flight: verdict and value in one flush.
|
|
154
|
+
next: e => {
|
|
155
|
+
const t = r.next(e);
|
|
156
|
+
if (o) {
|
|
157
|
+
o = false;
|
|
158
|
+
if (isThenable(t)) t.then(done, done); else done();
|
|
159
|
+
}
|
|
160
|
+
return t;
|
|
161
|
+
},
|
|
162
|
+
return: e => r.return?.(e) ?? Promise.resolve({
|
|
163
|
+
done: true,
|
|
164
|
+
value: e
|
|
165
|
+
})
|
|
166
|
+
};
|
|
167
|
+
ask(n);
|
|
168
|
+
return serve({
|
|
169
|
+
[Symbol.asyncIterator]: () => n
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
land(o);
|
|
174
|
+
return t;
|
|
139
175
|
} catch (e) {
|
|
140
176
|
// The wrapping form: an unready source parks the node in the window,
|
|
141
177
|
// and the wait is its flight until the source's settle re-runs it.
|
|
142
|
-
if (n && e instanceof NotReadyError) ask(e);
|
|
178
|
+
if (n && e instanceof NotReadyError) ask(e); else land(o);
|
|
143
179
|
throw e;
|
|
144
180
|
}
|
|
145
|
-
if (n && typeof c === "object" && c !== null) {
|
|
146
|
-
if (isThenable(c)) {
|
|
147
|
-
ask(c);
|
|
148
|
-
const done = () => land(c, true);
|
|
149
|
-
c.then(done, done);
|
|
150
|
-
return serve(c);
|
|
151
|
-
}
|
|
152
|
-
const e = c[Symbol.asyncIterator];
|
|
153
|
-
if (e) {
|
|
154
|
-
// A stream's flight ends at its first yield (or its end).
|
|
155
|
-
const r = e.call(c);
|
|
156
|
-
let t = true;
|
|
157
|
-
const done = () => land(o, true);
|
|
158
|
-
const o = {
|
|
159
|
-
// Registered ahead of the engine's own reaction to the same
|
|
160
|
-
// promise, as for a plain flight: verdict and value in one flush.
|
|
161
|
-
next: e => {
|
|
162
|
-
const o = r.next(e);
|
|
163
|
-
if (t) t = false, o.then(done, done);
|
|
164
|
-
return o;
|
|
165
|
-
},
|
|
166
|
-
return: e => r.return?.(e) ?? Promise.resolve({
|
|
167
|
-
done: true,
|
|
168
|
-
value: e
|
|
169
|
-
})
|
|
170
|
-
};
|
|
171
|
-
ask(o);
|
|
172
|
-
return serve({
|
|
173
|
-
[Symbol.asyncIterator]: () => o
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
land(o);
|
|
178
|
-
return c;
|
|
179
181
|
}, r));
|
|
180
182
|
}
|
|
181
183
|
|