@solidjs/signals 2.0.0-rc.8 → 2.0.0-rc.9
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 +1399 -285
- package/dist/dev.attribution.js +459 -307
- package/dist/dev.js +1864 -435
- package/dist/observe/affects.js +3 -1
- package/dist/observe/attribution.js +7 -1
- package/dist/observe/boundaries.js +209 -154
- package/dist/observe/core/action.js +18 -8
- package/dist/observe/core/async.js +220 -110
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +282 -0
- package/dist/observe/core/attribution-hooks.js +23 -1
- package/dist/observe/core/attribution-queries.js +28 -0
- package/dist/observe/core/attribution.js +262 -485
- package/dist/observe/core/constants.js +34 -1
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +867 -367
- package/dist/observe/core/dev.js +78 -17
- package/dist/observe/core/effect.js +67 -51
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/external.js +4 -4
- package/dist/observe/core/graph.js +37 -37
- package/dist/observe/core/heap.js +45 -45
- package/dist/observe/core/invariants.js +2 -0
- package/dist/observe/core/lanes.js +86 -49
- package/dist/observe/core/optimistic.js +242 -95
- package/dist/observe/core/owner.js +98 -84
- package/dist/observe/core/scheduler.js +543 -305
- package/dist/observe/core/verdict.js +247 -129
- package/dist/observe/index.js +7 -3
- package/dist/observe/map.js +126 -124
- package/dist/observe/signals.js +33 -17
- package/dist/observe/store/index.js +2 -0
- package/dist/observe/store/next/optimistic.js +141 -132
- package/dist/observe/store/next/projection.js +34 -21
- package/dist/observe/store/next/reconcile.js +58 -56
- package/dist/observe/store/next/store.js +260 -146
- package/dist/observe/store/store.js +5 -3
- package/dist/observe/store/utils.js +948 -135
- package/dist/prod/attribution.js +26 -17
- package/dist/prod/boundaries.js +128 -76
- package/dist/prod/core/action.js +16 -8
- package/dist/prod/core/async.js +251 -143
- package/dist/prod/core/constants.js +34 -1
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +843 -347
- package/dist/prod/core/dev.js +17 -1
- package/dist/prod/core/effect.js +48 -34
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +37 -37
- package/dist/prod/core/heap.js +45 -45
- package/dist/prod/core/lanes.js +90 -53
- package/dist/prod/core/optimistic.js +247 -100
- package/dist/prod/core/owner.js +57 -45
- package/dist/prod/core/scheduler.js +543 -305
- package/dist/prod/core/verdict.js +245 -127
- package/dist/prod/index.js +7 -3
- package/dist/prod/map.js +112 -112
- package/dist/prod/signals.js +28 -12
- package/dist/prod/store/next/optimistic.js +135 -128
- package/dist/prod/store/next/projection.js +31 -20
- package/dist/prod/store/next/store.js +325 -252
- package/dist/prod/store/store.js +2 -2
- package/dist/prod/store/utils.js +946 -135
- package/dist/types/attribution.d.ts +7 -2
- package/dist/types/attribution.prod.d.ts +10 -1
- package/dist/types/boundaries.d.ts +10 -1
- package/dist/types/core/action.d.ts +12 -5
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +28 -3
- package/dist/types/core/attribution-queries.d.ts +10 -0
- package/dist/types/core/attribution.d.ts +51 -172
- package/dist/types/core/constants.d.ts +33 -0
- package/dist/types/core/core.d.ts +186 -5
- package/dist/types/core/dev.d.ts +129 -9
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/index.d.ts +3 -1
- package/dist/types/core/invariants.d.ts +4 -0
- package/dist/types/core/lanes.d.ts +31 -4
- package/dist/types/core/scheduler.d.ts +95 -2
- package/dist/types/core/types.d.ts +3 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/signals.d.ts +8 -0
- package/dist/types/store/index.d.ts +2 -1
- package/dist/types/store/next/optimistic.d.ts +1 -1
- package/dist/types/store/next/store.d.ts +6 -5
- package/dist/types/store/next/target.d.ts +1 -1
- package/dist/types/store/utils.d.ts +177 -6
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { REACTIVE_IN_HEAP, REACTIVE_IN_HEAP_HEIGHT, REACTIVE_ZOMBIE, REACTIVE_RE
|
|
|
5
5
|
import { zombieQueue, dirtyQueue } from "./scheduler.js";
|
|
6
6
|
|
|
7
7
|
/** The queue a node belongs to, picked from its own zombie flag. */ function queueFor(e) {
|
|
8
|
-
return e.
|
|
8
|
+
return e.ft & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -16,34 +16,34 @@ import { zombieQueue, dirtyQueue } from "./scheduler.js";
|
|
|
16
16
|
* (see GlobalQueue._update, #3291).
|
|
17
17
|
*/ function enqueueSub(e) {
|
|
18
18
|
const E = queueFor(e);
|
|
19
|
-
if (E.
|
|
19
|
+
if (E.Ct > e.Rt) E.Ct = e.Rt;
|
|
20
20
|
insertIntoHeap(e, E);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function actualInsertIntoHeap(e, E) {
|
|
24
|
-
const t = (e.
|
|
25
|
-
if (t >= e.
|
|
26
|
-
const n = e.
|
|
24
|
+
const t = (e._parent?.cn ? e._parent.fn?.Rt : e._parent?.Rt) ?? -1;
|
|
25
|
+
if (t >= e.Rt) e.Rt = t + 1;
|
|
26
|
+
const n = e.Rt;
|
|
27
27
|
const I = E.eE[n];
|
|
28
28
|
if (I === undefined) E.eE[n] = e; else {
|
|
29
|
-
const E = I.
|
|
30
|
-
E.
|
|
31
|
-
e.
|
|
32
|
-
I.
|
|
29
|
+
const E = I.Mt;
|
|
30
|
+
E.Wt = e;
|
|
31
|
+
e.Mt = E;
|
|
32
|
+
I.Mt = e;
|
|
33
33
|
}
|
|
34
34
|
if (n > E.EE) E.EE = n;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function insertIntoHeap(e, E) {
|
|
38
|
-
let t = e.
|
|
38
|
+
let t = e.ft;
|
|
39
39
|
// RECOMPUTING refusals are not always losses: a genuinely missed wake (a
|
|
40
40
|
// write to a link this pass already validated) is latched link-side in
|
|
41
41
|
// insertSubs as REACTIVE_MISSED_WAKE for recompute's tail (#3037).
|
|
42
42
|
if (t & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
43
43
|
if (t & REACTIVE_CHECK) {
|
|
44
|
-
e.
|
|
44
|
+
e.ft = t & -4 | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
45
45
|
} else {
|
|
46
|
-
e.
|
|
46
|
+
e.ft = t | REACTIVE_IN_HEAP;
|
|
47
47
|
// An unmarked node entering an already-marked heap is marked on the
|
|
48
48
|
// spot, keeping the markHeap memo valid. `_marked` is only reset by
|
|
49
49
|
// runHeap, so a write between two mid-tick pulls (read-time markHeap +
|
|
@@ -60,52 +60,52 @@ function insertIntoHeap(e, E) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function insertIntoHeapHeight(e, E) {
|
|
63
|
-
let t = e.
|
|
63
|
+
let t = e.ft;
|
|
64
64
|
if (t & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)) return;
|
|
65
|
-
e.
|
|
65
|
+
e.ft = t | REACTIVE_IN_HEAP_HEIGHT;
|
|
66
66
|
actualInsertIntoHeap(e, E);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function deleteFromHeap(e, E) {
|
|
70
|
-
const t = e.
|
|
70
|
+
const t = e.ft;
|
|
71
71
|
if (!(t & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
72
|
-
e.
|
|
73
|
-
const n = e.
|
|
74
|
-
if (e.
|
|
75
|
-
const t = e.
|
|
72
|
+
e.ft = t & -25;
|
|
73
|
+
const n = e.Rt;
|
|
74
|
+
if (e.Mt === e) E.eE[n] = undefined; else {
|
|
75
|
+
const t = e.Wt;
|
|
76
76
|
const I = E.eE[n];
|
|
77
77
|
const o = t ?? I;
|
|
78
|
-
if (e === I) E.eE[n] = t; else e.
|
|
79
|
-
o.
|
|
78
|
+
if (e === I) E.eE[n] = t; else e.Mt.Wt = t;
|
|
79
|
+
o.Mt = e.Mt;
|
|
80
80
|
}
|
|
81
|
-
e.
|
|
82
|
-
e.
|
|
81
|
+
e.Mt = e;
|
|
82
|
+
e.Wt = undefined;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function markHeap(e) {
|
|
86
86
|
if (e.tE) return;
|
|
87
87
|
e.tE = true;
|
|
88
88
|
for (let E = 0; E <= e.EE; E++) {
|
|
89
|
-
for (let t = e.eE[E]; t !== undefined; t = t.
|
|
90
|
-
if (t.
|
|
89
|
+
for (let t = e.eE[E]; t !== undefined; t = t.Wt) {
|
|
90
|
+
if (t.ft & REACTIVE_IN_HEAP) markNode(t);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function markNode(e, E = REACTIVE_DIRTY) {
|
|
96
|
-
const t = e.
|
|
96
|
+
const t = e.ft;
|
|
97
97
|
if ((t & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= E) return;
|
|
98
|
-
e.
|
|
99
|
-
for (let E = e.u; E !== null; E = E.
|
|
100
|
-
markNode(E.
|
|
98
|
+
e.ft = t & -4 | E;
|
|
99
|
+
for (let E = e.u; E !== null; E = E.ie) {
|
|
100
|
+
markNode(E.se, REACTIVE_CHECK);
|
|
101
101
|
}
|
|
102
102
|
// Firewall children (projection machinery only): gate the cold-extension
|
|
103
103
|
// deref on the config bit — markNode runs per sub edge per write, and an
|
|
104
104
|
// unconditional _x chase here taxed every propagation (diamond -22%).
|
|
105
|
-
if (e.
|
|
105
|
+
if (e.C & CONFIG_FW_CHILDREN) {
|
|
106
106
|
for (let E = e.o.i; E !== null; E = E.ue) {
|
|
107
|
-
for (let e = E.u; e !== null; e = e.
|
|
108
|
-
markNode(e.
|
|
107
|
+
for (let e = E.u; e !== null; e = e.ie) {
|
|
108
|
+
markNode(e.se, REACTIVE_CHECK);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -113,11 +113,11 @@ function markNode(e, E = REACTIVE_DIRTY) {
|
|
|
113
113
|
|
|
114
114
|
function runHeap(e, E) {
|
|
115
115
|
e.tE = false;
|
|
116
|
-
for (e.
|
|
117
|
-
let t = e.eE[e.
|
|
116
|
+
for (e.Ct = 0; e.Ct <= e.EE; e.Ct++) {
|
|
117
|
+
let t = e.eE[e.Ct];
|
|
118
118
|
while (t !== undefined) {
|
|
119
|
-
if (t.
|
|
120
|
-
t = e.eE[e.
|
|
119
|
+
if (t.ft & REACTIVE_IN_HEAP) E(t); else adjustHeight(t, e);
|
|
120
|
+
t = e.eE[e.Ct];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
e.EE = 0;
|
|
@@ -125,21 +125,21 @@ function runHeap(e, E) {
|
|
|
125
125
|
|
|
126
126
|
function adjustHeight(e, E) {
|
|
127
127
|
deleteFromHeap(e, E);
|
|
128
|
-
let t = e.
|
|
129
|
-
for (let E = e.
|
|
130
|
-
const e = E.
|
|
131
|
-
const n = e.
|
|
132
|
-
if (n.
|
|
128
|
+
let t = e.Rt;
|
|
129
|
+
for (let E = e.ee; E; E = E.te) {
|
|
130
|
+
const e = E.re;
|
|
131
|
+
const n = e.ne || e;
|
|
132
|
+
if (n.ht && n.Rt >= t) t = n.Rt + 1;
|
|
133
133
|
}
|
|
134
|
-
if (e.
|
|
135
|
-
e.
|
|
136
|
-
for (let E = e.u; E !== null; E = E.
|
|
134
|
+
if (e.Rt !== t) {
|
|
135
|
+
e.Rt = t;
|
|
136
|
+
for (let E = e.u; E !== null; E = E.ie) {
|
|
137
137
|
// Route each subscriber by its own zombie flag, mirroring the
|
|
138
138
|
// post-recompute height-adjust path. Inserting into the running `heap`
|
|
139
139
|
// unconditionally can park a zombie in `dirtyQueue` (or a live node in
|
|
140
140
|
// `zombieQueue`), breaking the flag/queue invariant `deleteFromHeap`
|
|
141
141
|
// relies on — the same corruption class as #2759.
|
|
142
|
-
insertIntoHeapHeight(E.
|
|
142
|
+
insertIntoHeapHeight(E.se, queueFor(E.se));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { CONFIG_HAS_LANE,
|
|
1
|
+
import { CONFIG_DERIVED_OVERRIDE, CONFIG_HAS_LANE, REACTIVE_DISPOSED } from "./constants.js";
|
|
2
2
|
|
|
3
|
-
import { ext } from "./core.js";
|
|
3
|
+
import { hasActiveOverride, ext, ownsHold, currentOptimisticLane } from "./core.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { enqueueSub } from "./heap.js";
|
|
6
|
+
|
|
7
|
+
import { currentTransition, activeTransition, waitingTransition } from "./scheduler.js";
|
|
6
8
|
|
|
7
9
|
// Map from optimistic signal to its lane (reused for multiple writes to same signal)
|
|
8
10
|
const signalLanes = new WeakMap;
|
|
@@ -20,16 +22,16 @@ const activeLanes = new Set;
|
|
|
20
22
|
}
|
|
21
23
|
// Detect parent lane: _parentSource chains from pendingSignal → pendingValueComputed → original.
|
|
22
24
|
// The child lane should not merge with the parent lane.
|
|
23
|
-
const i = n.o?.
|
|
24
|
-
const t = i?.o?.
|
|
25
|
+
const i = n.o?.nn;
|
|
26
|
+
const t = i?.o?.de;
|
|
25
27
|
const r = t ? findLane(t) : null;
|
|
26
28
|
e = {
|
|
27
29
|
Ln: n,
|
|
28
|
-
|
|
30
|
+
Ie: new Set,
|
|
29
31
|
vn: [ [], [] ],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
wn: null,
|
|
33
|
+
Te: activeTransition,
|
|
34
|
+
Hn: r
|
|
33
35
|
};
|
|
34
36
|
signalLanes.set(n, e);
|
|
35
37
|
activeLanes.add(e);
|
|
@@ -39,8 +41,8 @@ const activeLanes = new Set;
|
|
|
39
41
|
// parent-child is a property of the nodes, not of write order — otherwise
|
|
40
42
|
// the owner's write merges the companion's subscribers into this lane and
|
|
41
43
|
// their effects wait on its async instead of flushing immediately.
|
|
42
|
-
adoptCompanionLane(n.o?.
|
|
43
|
-
adoptCompanionLane(n.o?.
|
|
44
|
+
adoptCompanionLane(n.o?.he, e);
|
|
45
|
+
adoptCompanionLane(n.o?.Ge, e);
|
|
44
46
|
return e;
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -51,13 +53,13 @@ function adoptCompanionLane(n, e) {
|
|
|
51
53
|
const t = findLane(i);
|
|
52
54
|
// Only the companion's own unmerged root is safely re-parentable: a root
|
|
53
55
|
// that absorbed other lanes carries work that is not a child of this owner.
|
|
54
|
-
if (t !== e && t.Ln === n && !t.
|
|
56
|
+
if (t !== e && t.Ln === n && !t.Hn) t.Hn = e;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
* Union-find: find the root lane.
|
|
59
61
|
*/ function findLane(n) {
|
|
60
|
-
while (n.
|
|
62
|
+
while (n.wn) n = n.wn;
|
|
61
63
|
return n;
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -77,23 +79,64 @@ function adoptCompanionLane(n, e) {
|
|
|
77
79
|
* the async the other member's transaction observed must hold the merged
|
|
78
80
|
* reveal just the same (A15 for lanes, #3335).
|
|
79
81
|
*/ function laneHeld(n) {
|
|
80
|
-
if (!n.
|
|
81
|
-
for (const e of n.
|
|
82
|
+
if (!n.Te) return false;
|
|
83
|
+
for (const e of n.Ie) if (waitingTransition(e) !== null) return true;
|
|
82
84
|
return false;
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Lanes mirror transitions (#3460): a render effect OFF a HELD lane that reads
|
|
89
|
+
* a value the lane is revealing — an override, a `latest()` shadow — sees the
|
|
90
|
+
* committed value, exactly as a stale reader of a held transaction does
|
|
91
|
+
* (A15 reveal corollary): it publishes now, with the frame that is on screen
|
|
92
|
+
* (the lane defers its own readers' runs, so the committed value is what is
|
|
93
|
+
* visible), entangles nothing — a sync write is never held by a lane — and
|
|
94
|
+
* re-derives at the release. The release re-run rides the lane's own render
|
|
95
|
+
* queue, which runs when the lane reveals (runLaneEffects) or its transaction
|
|
96
|
+
* commits (cleanupCompletedLanes). A reader ON the lane computes the lane's
|
|
97
|
+
* reveal and takes the value as before.
|
|
98
|
+
*
|
|
99
|
+
* OFF the lane is provenance, not membership — the transaction mirror
|
|
100
|
+
* exactly: a stale reader of a transaction is a pass that runs outside it. A
|
|
101
|
+
* pass under the lane's own transaction is the lane's work — its write (lane
|
|
102
|
+
* posture), or the landing of its async, which re-enters the transaction
|
|
103
|
+
* (#3334) and runs a member with no ambient lane. Read as an outsider, that
|
|
104
|
+
* pass published the committed view and queued a replay that revealed the
|
|
105
|
+
* override beside its unready derivation at the release (`1:0` for an
|
|
106
|
+
* optimistic frame that never became ready; #3479 review). Membership is the
|
|
107
|
+
* wrong test the other way: a member re-run by a sibling's sync write is a
|
|
108
|
+
* mainline pass and shows the committed view.
|
|
109
|
+
*/ function readsHeldCommitted(n, e) {
|
|
110
|
+
const i = resolveLane(n);
|
|
111
|
+
if (!i || !laneHeld(i)) return false;
|
|
112
|
+
if (ownsLane(i, n)) return false;
|
|
113
|
+
i.vn[0].push(() => e.ft & REACTIVE_DISPOSED || enqueueSub(e));
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The ownership relation for a lane hold (core `ownsHold`, §6 ruling 2): the
|
|
118
|
+
* running pass owns `lane`'s hold if it runs under the transition that owns
|
|
119
|
+
* the lane (the node's, resolved through override ownership and merges) or
|
|
120
|
+
* inside the lane itself. */ function ownsLane(n, e) {
|
|
121
|
+
if (activeTransition !== null) {
|
|
122
|
+
const n = resolveTransition(e);
|
|
123
|
+
if (n && ownsHold(n)) return true;
|
|
124
|
+
}
|
|
125
|
+
return currentOptimisticLane !== null && findLane(currentOptimisticLane) === n;
|
|
126
|
+
}
|
|
127
|
+
|
|
85
128
|
/**
|
|
86
129
|
* Merge two lanes when their dependency graphs overlap.
|
|
87
130
|
*/ function mergeLanes(n, e) {
|
|
88
131
|
n = findLane(n);
|
|
89
132
|
e = findLane(e);
|
|
90
133
|
if (n === e) return n;
|
|
91
|
-
e.
|
|
134
|
+
e.wn = n;
|
|
92
135
|
// Move (not copy) the merged lane's work: after the merge all routing goes
|
|
93
136
|
// through findLane() to the root, so anything left behind here is dead —
|
|
94
137
|
// and anything *added* here later is a routing bug (INV-5).
|
|
95
|
-
for (const i of e.
|
|
96
|
-
e.
|
|
138
|
+
for (const i of e.Ie) n.Ie.add(i);
|
|
139
|
+
e.Ie.clear();
|
|
97
140
|
n.vn[0].push(...e.vn[0]);
|
|
98
141
|
n.vn[1].push(...e.vn[1]);
|
|
99
142
|
e.vn[0].length = 0;
|
|
@@ -104,11 +147,11 @@ function adoptCompanionLane(n, e) {
|
|
|
104
147
|
/**
|
|
105
148
|
* Resolve a node's lane: follow union-find chain, verify active, clear if stale.
|
|
106
149
|
*/ function resolveLane(n) {
|
|
107
|
-
const e = n.o?.
|
|
150
|
+
const e = n.o?.de;
|
|
108
151
|
if (!e) return undefined;
|
|
109
152
|
const i = findLane(e);
|
|
110
153
|
if (activeLanes.has(i)) return i;
|
|
111
|
-
if (n.o !== null) n.o.
|
|
154
|
+
if (n.o !== null) n.o.de = undefined;
|
|
112
155
|
return undefined;
|
|
113
156
|
}
|
|
114
157
|
|
|
@@ -118,19 +161,12 @@ function resolveTransition(n) {
|
|
|
118
161
|
// transactions (#2912) — the merged root's _transition would hand this
|
|
119
162
|
// node's override to whichever action wrote last through the shared
|
|
120
163
|
// reader. Chase merge chains; a dead owner settled through another path.
|
|
121
|
-
if (hasActiveOverride(n) && n.o?.
|
|
122
|
-
const e = ext(n).
|
|
123
|
-
if (e.
|
|
124
|
-
if (n.o !== null) n.o.
|
|
164
|
+
if (hasActiveOverride(n) && n.o?.jt) {
|
|
165
|
+
const e = ext(n).jt = currentTransition(n.o?.jt);
|
|
166
|
+
if (e.yt !== true) return e;
|
|
167
|
+
if (n.o !== null) n.o.jt = null;
|
|
125
168
|
}
|
|
126
|
-
return resolveLane(n)?.
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Check if a node has an active optimistic override.
|
|
131
|
-
*/ function hasActiveOverride(n) {
|
|
132
|
-
const e = n.o;
|
|
133
|
-
return e !== null && e.De !== undefined && e.De !== NOT_PENDING;
|
|
169
|
+
return resolveLane(n)?.Te ?? n.Te;
|
|
134
170
|
}
|
|
135
171
|
|
|
136
172
|
/**
|
|
@@ -138,31 +174,32 @@ function resolveTransition(n) {
|
|
|
138
174
|
* a different active lane), merge unless the node has an active override.
|
|
139
175
|
*/ function assignOrMergeLane(n, e) {
|
|
140
176
|
const i = findLane(e);
|
|
141
|
-
const t = n.o?.
|
|
177
|
+
const t = n.o?.de;
|
|
142
178
|
if (t) {
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
// (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
179
|
+
// A merged lane is followed to its root like any other: the root is where
|
|
180
|
+
// the subscriber's affinity lives now. Replacing it with the source lane
|
|
181
|
+
// outright (as this once did) skipped the parent/child check below — an
|
|
182
|
+
// isPending reader of two async siblings had their two companion lanes
|
|
183
|
+
// merge, and the next parent-lane notification then moved it onto the
|
|
184
|
+
// held parent, where its verdict waited on the async it reports (#3409).
|
|
151
185
|
const r = findLane(t);
|
|
152
186
|
if (activeLanes.has(r)) {
|
|
153
|
-
|
|
187
|
+
// A WRITTEN override is its own lane's source and merges nothing
|
|
188
|
+
// through it; a derived one (lanes stage, #3479) is a plain member —
|
|
189
|
+
// the shared reader that merges two writers' lanes carries one.
|
|
190
|
+
if (r !== i && (!hasActiveOverride(n) || n.C & CONFIG_DERIVED_OVERRIDE)) {
|
|
154
191
|
// Parent-child lanes stay independent so isPending resolves without
|
|
155
192
|
// waiting for the parent's async. The child keeps ownership.
|
|
156
|
-
if (i.
|
|
157
|
-
ext(n).
|
|
158
|
-
n.
|
|
159
|
-
} else if (r.
|
|
193
|
+
if (i.Hn && findLane(i.Hn) === r) {
|
|
194
|
+
ext(n).de = e;
|
|
195
|
+
n.C |= CONFIG_HAS_LANE;
|
|
196
|
+
} else if (r.Hn && findLane(r.Hn) === i) ; else mergeLanes(i, r);
|
|
160
197
|
}
|
|
161
198
|
return;
|
|
162
199
|
}
|
|
163
200
|
}
|
|
164
|
-
ext(n).
|
|
165
|
-
n.
|
|
201
|
+
ext(n).de = e;
|
|
202
|
+
n.C |= CONFIG_HAS_LANE;
|
|
166
203
|
}
|
|
167
204
|
|
|
168
|
-
export { activeLanes, assignOrMergeLane, findLane, getOrCreateLane, hasActiveOverride, laneHeld, mergeLanes, resolveLane, resolveTransition, signalLanes };
|
|
205
|
+
export { activeLanes, assignOrMergeLane, findLane, getOrCreateLane, hasActiveOverride, laneHeld, mergeLanes, ownsLane, readsHeldCommitted, resolveLane, resolveTransition, signalLanes };
|