@solidjs/signals 2.0.0-beta.25 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +370 -73
- package/dist/node.cjs +1247 -946
- package/dist/prod/core/action.js +11 -6
- package/dist/prod/core/async.js +212 -108
- package/dist/prod/core/core.js +203 -189
- package/dist/prod/core/effect.js +28 -28
- package/dist/prod/core/external.js +3 -3
- package/dist/prod/core/graph.js +28 -28
- package/dist/prod/core/heap.js +30 -30
- package/dist/prod/core/lanes.js +15 -15
- package/dist/prod/core/optimistic.js +39 -39
- package/dist/prod/core/owner.js +44 -44
- package/dist/prod/core/scheduler.js +127 -106
- package/dist/prod/core/verdict.js +54 -54
- package/dist/prod/map.js +60 -60
- package/dist/prod/signals.js +1 -1
- package/dist/prod/store/optimistic.js +55 -36
- package/dist/prod/store/projection.js +38 -33
- package/dist/prod/store/reconcile.js +299 -243
- package/dist/prod/store/store.js +127 -50
- package/dist/types/core/async.d.ts +2 -0
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/store/optimistic.d.ts +2 -2
- package/dist/types/store/projection.d.ts +7 -2
- package/dist/types/store/reconcile.d.ts +14 -0
- package/dist/types/store/store.d.ts +2 -2
- package/dist/types-cjs/core/async.d.cts +2 -0
- package/dist/types-cjs/core/scheduler.d.cts +1 -0
- package/dist/types-cjs/store/optimistic.d.cts +2 -2
- package/dist/types-cjs/store/projection.d.cts +7 -2
- package/dist/types-cjs/store/reconcile.d.cts +14 -0
- package/dist/types-cjs/store/store.d.cts +2 -2
- package/package.json +1 -1
|
@@ -32,21 +32,21 @@ let pendingProbe = null;
|
|
|
32
32
|
* Get or create the pending signal for a node (lazy).
|
|
33
33
|
* Used by isPending() to track pending state reactively.
|
|
34
34
|
*/ function getPendingSignal(e) {
|
|
35
|
-
if (!e.
|
|
35
|
+
if (!e.he) {
|
|
36
36
|
// Start false, write true if pending - ensures reversion returns to false
|
|
37
|
-
e.
|
|
37
|
+
e.he = optimisticSignal(false, {
|
|
38
38
|
ownedWrite: true
|
|
39
39
|
});
|
|
40
|
-
e.
|
|
41
|
-
if (computePendingState(e)) setSignal(e.
|
|
40
|
+
e.he.nn = e;
|
|
41
|
+
if (computePendingState(e)) setSignal(e.he, true);
|
|
42
42
|
}
|
|
43
|
-
return e.
|
|
43
|
+
return e.he;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function collectPendingSources(e) {
|
|
47
47
|
if (!pendingProbe) return;
|
|
48
48
|
pendingProbe.sources.add(e);
|
|
49
|
-
const t = e.
|
|
49
|
+
const t = e.it || e;
|
|
50
50
|
if (t !== e) pendingProbe.sources.add(t);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -79,17 +79,17 @@ function collectPendingSources(e) {
|
|
|
79
79
|
if (e.S & STATUS_ERROR) return false;
|
|
80
80
|
if (t.has(e)) return false;
|
|
81
81
|
t.add(e);
|
|
82
|
-
const n = e.
|
|
82
|
+
const n = e.it;
|
|
83
83
|
if (n && markWalk(n, t)) return true;
|
|
84
84
|
// Mid-recompute (the clearStatus companion poke runs before
|
|
85
85
|
// trimStaleDeps), only the validated prefix [_deps.._depsTail] is this
|
|
86
86
|
// pass's dependency set — walking past it would read dropped deps and
|
|
87
87
|
// latch a stale verdict on the companion.
|
|
88
88
|
const i = e;
|
|
89
|
-
const r = i.se & REACTIVE_RECOMPUTING_DEPS ? i.
|
|
89
|
+
const r = i.se & REACTIVE_RECOMPUTING_DEPS ? i.We : undefined;
|
|
90
90
|
if (r !== null) {
|
|
91
|
-
for (let e = i.
|
|
92
|
-
if (!e.
|
|
91
|
+
for (let e = i.et ?? null; e !== null; e = e.tt) {
|
|
92
|
+
if (!e.Oe && markWalk(e.nt, t)) return true;
|
|
93
93
|
if (e === r) break;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -102,10 +102,10 @@ function collectPendingSources(e) {
|
|
|
102
102
|
|
|
103
103
|
function quietPending(e) {
|
|
104
104
|
if (e.oe) {
|
|
105
|
-
for (const t of e.oe) if (!t.
|
|
105
|
+
for (const t of e.oe) if (!t.Re) return false;
|
|
106
106
|
return true;
|
|
107
107
|
}
|
|
108
|
-
return e.
|
|
108
|
+
return e.Re;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function newQuestionInFlight(e) {
|
|
@@ -119,37 +119,37 @@ function computePendingState(e) {
|
|
|
119
119
|
// reaches its owner (and a store leaf its firewall) through its own deps,
|
|
120
120
|
// so the one walk covers direct marks, derivation, and companion chains.
|
|
121
121
|
if (markCovered(e)) return true;
|
|
122
|
-
const n = e.
|
|
122
|
+
const n = e.it;
|
|
123
123
|
if (e.nn) {
|
|
124
124
|
const t = e.nn;
|
|
125
|
-
const n = t.
|
|
125
|
+
const n = t.it || t;
|
|
126
126
|
return newQuestionInFlight(n);
|
|
127
127
|
}
|
|
128
|
-
if (n && e.
|
|
128
|
+
if (n && e.De !== NOT_PENDING && !hasActiveOverride(e)) {
|
|
129
129
|
return !!(n.se & REACTIVE_MANUAL_WRITE) || !n.Te && !(n.S & STATUS_PENDING) || !!(n.S & STATUS_PENDING) && quietPending(n);
|
|
130
130
|
}
|
|
131
|
-
if (e.
|
|
132
|
-
if (hasActiveOverride(e)) return !e.
|
|
131
|
+
if (e.De !== NOT_PENDING && !(t.S & STATUS_UNINITIALIZED)) {
|
|
132
|
+
if (hasActiveOverride(e)) return !e.be || !e.be(e.De, unwrapOverride(e.Ae));
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
135
135
|
return newQuestionInFlight(t);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
function syncCompanions(e, t) {
|
|
139
|
-
if (e.
|
|
140
|
-
if (e.
|
|
139
|
+
if (e.he) updatePendingSignal(e);
|
|
140
|
+
if (e.pe) setSignal(e.pe, t);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
function updatePendingSignal(e) {
|
|
144
|
-
if (e.
|
|
145
|
-
setSignal(e.
|
|
144
|
+
if (e.he) {
|
|
145
|
+
setSignal(e.he, computePendingState(e));
|
|
146
146
|
}
|
|
147
|
-
if (e.
|
|
147
|
+
if (e.pe) updatePendingSignal(e.pe);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
function updateChildCompanions(e) {
|
|
151
151
|
for (let t = e.u; t !== null; t = t.fe) {
|
|
152
|
-
if (t.
|
|
152
|
+
if (t.he || t.pe) updatePendingSignal(t);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -167,7 +167,7 @@ function updateChildCompanions(e) {
|
|
|
167
167
|
const visit = e => {
|
|
168
168
|
if (i.has(e)) return;
|
|
169
169
|
i.add(e);
|
|
170
|
-
if (e.
|
|
170
|
+
if (e.he || e.pe) n(e);
|
|
171
171
|
for (let t = e.o; t !== null; t = t.ue) visit(t.le);
|
|
172
172
|
for (let t = e.u ?? null; t !== null; t = t.fe) {
|
|
173
173
|
visit(t);
|
|
@@ -177,20 +177,20 @@ function updateChildCompanions(e) {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
function snapCompanionsToState(e) {
|
|
180
|
-
const t = e.
|
|
181
|
-
if (t && (t.
|
|
180
|
+
const t = e.he;
|
|
181
|
+
if (t && (t.Ae === undefined || t.Ae === NOT_PENDING)) {
|
|
182
182
|
const n = computePendingState(e);
|
|
183
|
-
if (t.
|
|
184
|
-
t.
|
|
185
|
-
t.
|
|
186
|
-
t.
|
|
183
|
+
if (t.Ue !== n || t.De !== NOT_PENDING) {
|
|
184
|
+
t.Ue = n;
|
|
185
|
+
t.De = NOT_PENDING;
|
|
186
|
+
t.Se = clock;
|
|
187
187
|
insertSubs(t);
|
|
188
188
|
schedule();
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
const n = e.
|
|
191
|
+
const n = e.pe;
|
|
192
192
|
if (n && !(n.se & REACTIVE_DISPOSED)) {
|
|
193
|
-
if ((n.
|
|
193
|
+
if ((n.Ae === undefined || n.Ae === NOT_PENDING) && n.De === NOT_PENDING && !Object.is(n.Ue, e.Ue) && !(n.se & (REACTIVE_DIRTY | REACTIVE_CHECK))) {
|
|
194
194
|
n.se |= REACTIVE_DIRTY;
|
|
195
195
|
insertIntoHeap(n, queueFor(n));
|
|
196
196
|
insertSubs(n);
|
|
@@ -201,7 +201,7 @@ function snapCompanionsToState(e) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
function getLatestValueComputed(e) {
|
|
204
|
-
if (!e.
|
|
204
|
+
if (!e.pe) {
|
|
205
205
|
const t = latestReadActive;
|
|
206
206
|
setLatestReadActive(false);
|
|
207
207
|
const n = pendingCheckActive;
|
|
@@ -209,21 +209,21 @@ function getLatestValueComputed(e) {
|
|
|
209
209
|
const i = context;
|
|
210
210
|
setContextInternal(null);
|
|
211
211
|
// Detach from owner so it isn't disposed with effects
|
|
212
|
-
e.
|
|
213
|
-
e.
|
|
212
|
+
e.pe = optimisticComputed(() => read(e));
|
|
213
|
+
e.pe.nn = e;
|
|
214
214
|
// Parent-child lane relationship
|
|
215
215
|
setContextInternal(i);
|
|
216
216
|
setPendingCheckActive(n);
|
|
217
217
|
setLatestReadActive(t);
|
|
218
218
|
}
|
|
219
|
-
return e.
|
|
219
|
+
return e.pe;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
/** The latest()-mode read path, installed as GlobalQueue._latestRead. */ function latestRead(e) {
|
|
223
223
|
const t = getLatestValueComputed(e);
|
|
224
224
|
const n = latestReadActive;
|
|
225
225
|
setLatestReadActive(false);
|
|
226
|
-
const i = e.
|
|
226
|
+
const i = e.Ae !== undefined && e.Ae !== NOT_PENDING ? unwrapOverride(e.Ae) : e.Ue;
|
|
227
227
|
let r;
|
|
228
228
|
try {
|
|
229
229
|
// An untracked latest() read has no reading context, so read() never
|
|
@@ -232,7 +232,7 @@ function getLatestValueComputed(e) {
|
|
|
232
232
|
// until the flush (#2922). Mirror the tracked-read pull here: mark the
|
|
233
233
|
// queued staleness through the graph, then bring the shadow up to date.
|
|
234
234
|
const e = queueFor(t);
|
|
235
|
-
if (t.
|
|
235
|
+
if (t.Ve >= e.He && !(t.se & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE))) {
|
|
236
236
|
markHeap(e);
|
|
237
237
|
prepareComputed(t, true);
|
|
238
238
|
}
|
|
@@ -244,10 +244,10 @@ function getLatestValueComputed(e) {
|
|
|
244
244
|
setLatestReadActive(n);
|
|
245
245
|
}
|
|
246
246
|
if (t.S & STATUS_PENDING) return i;
|
|
247
|
-
if (stale && currentOptimisticLane && t.
|
|
248
|
-
const e = findLane(t.
|
|
247
|
+
if (stale && currentOptimisticLane && t.Me) {
|
|
248
|
+
const e = findLane(t.Me);
|
|
249
249
|
const n = findLane(currentOptimisticLane);
|
|
250
|
-
if (e !== n && e.
|
|
250
|
+
if (e !== n && e.Ne.size > 0) {
|
|
251
251
|
return i;
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -255,13 +255,13 @@ function getLatestValueComputed(e) {
|
|
|
255
255
|
// speculative value in _pendingValue; a contextless read() only surfaces
|
|
256
256
|
// _value. Overrides stay authoritative (A17), and stale readers keep the
|
|
257
257
|
// other transition's committed view, matching read()'s own selection.
|
|
258
|
-
if (t.
|
|
258
|
+
if (t.De !== NOT_PENDING && !hasActiveOverride(t) && !(stale && t.Ie && activeTransition !== t.Ie)) return t.De;
|
|
259
259
|
return r;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/** The isPending()-probe read path, installed as GlobalQueue._pendingCheck. */ function pendingCheckRead(e, t, n, i) {
|
|
263
263
|
setPendingCheckActive(false);
|
|
264
|
-
if (typeof e.
|
|
264
|
+
if (typeof e.ae === "function") prepareComputed(e, true);
|
|
265
265
|
const r = n.S;
|
|
266
266
|
if (t && r & STATUS_PENDING && r & STATUS_UNINITIALIZED) {
|
|
267
267
|
if (tracking && e !== t) link(e, t);
|
|
@@ -274,14 +274,14 @@ function getLatestValueComputed(e) {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
function recordFreshRead(e, t) {
|
|
277
|
-
if (pendingProbe !== null && e.
|
|
277
|
+
if (pendingProbe !== null && e.De !== NOT_PENDING && t === e.De) pendingProbe.freshReads.add(e);
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
function applyReask(e, t) {
|
|
281
281
|
const n = !!(e.S & STATUS_PENDING);
|
|
282
|
-
const i = t && !(n && !e.
|
|
283
|
-
const r = n && e.
|
|
284
|
-
e.
|
|
282
|
+
const i = t && !(n && !e.Re);
|
|
283
|
+
const r = n && e.Re !== i;
|
|
284
|
+
e.Re = i;
|
|
285
285
|
return r;
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -335,21 +335,21 @@ function isPending(e) {
|
|
|
335
335
|
// Hook installation (same late-binding pattern as GlobalQueue._update /
|
|
336
336
|
// _propagateAffects): core call sites fire these behind the same guards the
|
|
337
337
|
// direct calls used, so behavior is identical once this module loads.
|
|
338
|
-
GlobalQueue.
|
|
338
|
+
GlobalQueue._e = syncCompanions;
|
|
339
339
|
|
|
340
|
-
GlobalQueue.
|
|
340
|
+
GlobalQueue.ce = updatePendingSignal;
|
|
341
341
|
|
|
342
|
-
GlobalQueue.
|
|
342
|
+
GlobalQueue.Ge = updateChildCompanions;
|
|
343
343
|
|
|
344
344
|
GlobalQueue.un = snapCompanionsToState;
|
|
345
345
|
|
|
346
|
-
GlobalQueue.
|
|
346
|
+
GlobalQueue.St = latestRead;
|
|
347
347
|
|
|
348
|
-
GlobalQueue.
|
|
348
|
+
GlobalQueue.At = pendingCheckRead;
|
|
349
349
|
|
|
350
|
-
GlobalQueue.
|
|
350
|
+
GlobalQueue.Pt = recordFreshRead;
|
|
351
351
|
|
|
352
|
-
GlobalQueue
|
|
352
|
+
GlobalQueue.$e = applyReask;
|
|
353
353
|
|
|
354
354
|
GlobalQueue.k = repollDownstreamVerdicts;
|
|
355
355
|
|
package/dist/prod/map.js
CHANGED
|
@@ -27,17 +27,17 @@ function mapArray(t, s, i) {
|
|
|
27
27
|
Mt: [],
|
|
28
28
|
Kt: n,
|
|
29
29
|
xt: [],
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
Gt: [],
|
|
31
|
+
Ut: e,
|
|
32
|
+
$t: e || i?.keyed === false ? [] : undefined,
|
|
33
|
+
qt: r && i?.keyed !== false ? [] : undefined,
|
|
34
|
+
zt: i?.keyed === false,
|
|
35
|
+
Bt: i?.fallback
|
|
36
36
|
};
|
|
37
37
|
const o = computed(updateKeyedMap.bind(h));
|
|
38
38
|
// Untracked reads inside the internal owner resolve via _parentComputed; routing
|
|
39
39
|
// them through node lets store-proxy lookups see pending writes (not stale _value).
|
|
40
|
-
h.wt.
|
|
40
|
+
h.wt.Tt = o;
|
|
41
41
|
o.T &= ~CONFIG_AUTO_DISPOSE;
|
|
42
42
|
return accessor(o);
|
|
43
43
|
}
|
|
@@ -63,14 +63,14 @@ function updateKeyedMap() {
|
|
|
63
63
|
let i, e, r, n,
|
|
64
64
|
// Mappers write freshly-created row/index signals into the STAGE
|
|
65
65
|
// arrays (`rows`/`indexes`), never into `this._rows`/`this._indexes`.
|
|
66
|
-
h = this
|
|
66
|
+
h = this.$t ? this.zt ? () => {
|
|
67
67
|
r[e] = signal(t[e], pureOptions);
|
|
68
68
|
return this.Kt(accessor(r[e]), e);
|
|
69
69
|
} : () => {
|
|
70
70
|
r[e] = signal(t[e], pureOptions);
|
|
71
71
|
n && (n[e] = signal(e, pureOptions));
|
|
72
72
|
return this.Kt(accessor(r[e]), n ? accessor(n[e]) : undefined);
|
|
73
|
-
} : this
|
|
73
|
+
} : this.qt ? () => {
|
|
74
74
|
const s = t[e];
|
|
75
75
|
n[e] = signal(e, pureOptions);
|
|
76
76
|
return this.Kt(s, accessor(n[e]));
|
|
@@ -82,26 +82,26 @@ function updateKeyedMap() {
|
|
|
82
82
|
if (s === 0) {
|
|
83
83
|
if (this.jt !== 0) {
|
|
84
84
|
this.wt.dispose(false);
|
|
85
|
-
this.
|
|
85
|
+
this.Gt = [];
|
|
86
86
|
this.Mt = [];
|
|
87
87
|
this.xt = [];
|
|
88
88
|
this.jt = 0;
|
|
89
|
-
this.Ut && (this.Ut = []);
|
|
90
89
|
this.$t && (this.$t = []);
|
|
90
|
+
this.qt && (this.qt = []);
|
|
91
91
|
}
|
|
92
|
-
if (this.
|
|
92
|
+
if (this.Bt && !this.xt[0]) {
|
|
93
93
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
94
94
|
// dispose it before re-creating
|
|
95
|
-
this.
|
|
96
|
-
this.xt[0] = runWithOwner(this.
|
|
95
|
+
this.Gt[0]?.dispose();
|
|
96
|
+
this.xt[0] = runWithOwner(this.Gt[0] = createOwner(), this.Bt);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
// fast path for new create
|
|
100
100
|
else if (this.jt === 0) {
|
|
101
101
|
const o = new Array(s);
|
|
102
102
|
const c = new Array(s);
|
|
103
|
-
r = this
|
|
104
|
-
n = this
|
|
103
|
+
r = this.$t && new Array(s);
|
|
104
|
+
n = this.qt && new Array(s);
|
|
105
105
|
try {
|
|
106
106
|
for (e = 0; e < s; e++) o[e] = runWithOwner(c[e] = createOwner(), h);
|
|
107
107
|
} catch (t) {
|
|
@@ -109,23 +109,23 @@ function updateKeyedMap() {
|
|
|
109
109
|
throw t;
|
|
110
110
|
}
|
|
111
111
|
// commit
|
|
112
|
-
if (this.
|
|
112
|
+
if (this.Gt[0]) this.Gt[0].dispose();
|
|
113
113
|
// previous fallback
|
|
114
114
|
this.xt = o;
|
|
115
|
-
this.
|
|
116
|
-
r && (this
|
|
117
|
-
n && (this
|
|
115
|
+
this.Gt = c;
|
|
116
|
+
r && (this.$t = r);
|
|
117
|
+
n && (this.qt = n);
|
|
118
118
|
this.Mt = t.slice(0);
|
|
119
119
|
this.jt = s;
|
|
120
120
|
} else {
|
|
121
121
|
let o, c, a, f, u, p, w, l, d;
|
|
122
122
|
// skip common prefix
|
|
123
|
-
for (o = 0, c = Math.min(this.jt, s); o < c && (this.Mt[o] === t[o] || this
|
|
124
|
-
if (this
|
|
123
|
+
for (o = 0, c = Math.min(this.jt, s); o < c && (this.Mt[o] === t[o] || this.$t && compare(this.Ut, this.Mt[o], t[o])); o++) {
|
|
124
|
+
if (this.$t) setSignal(this.$t[o], t[o]);
|
|
125
125
|
}
|
|
126
126
|
// skip common suffix — counted only; retained entries land in one pass
|
|
127
127
|
// at commit instead of being staged and copied twice
|
|
128
|
-
for (c = this.jt - 1, a = s - 1; c >= o && a >= o && (this.Mt[c] === t[a] || this
|
|
128
|
+
for (c = this.jt - 1, a = s - 1; c >= o && a >= o && (this.Mt[c] === t[a] || this.$t && compare(this.Ut, this.Mt[c], t[a])); c--,
|
|
129
129
|
a--) ;
|
|
130
130
|
// no structural change (every position matched in place at equal
|
|
131
131
|
// length — the common post-reconcile shape): keep the same mapped
|
|
@@ -137,15 +137,15 @@ function updateKeyedMap() {
|
|
|
137
137
|
const O = s - this.jt;
|
|
138
138
|
const m = new Array(s);
|
|
139
139
|
const _ = new Array(s);
|
|
140
|
-
r = this
|
|
141
|
-
n = this
|
|
140
|
+
r = this.$t ? new Array(s) : undefined;
|
|
141
|
+
n = this.qt ? new Array(s) : undefined;
|
|
142
142
|
// 0) prepare a map of all indices in the changed window of newItems,
|
|
143
143
|
// scanning backwards so we encounter them in natural order
|
|
144
144
|
p = new Map;
|
|
145
145
|
w = new Array(a + 1);
|
|
146
146
|
for (e = a; e >= o; e--) {
|
|
147
147
|
f = t[e];
|
|
148
|
-
u = this.
|
|
148
|
+
u = this.Ut ? this.Ut(f) : f;
|
|
149
149
|
i = p.get(u);
|
|
150
150
|
w[e] = i === undefined ? -1 : i;
|
|
151
151
|
p.set(u, e);
|
|
@@ -155,16 +155,16 @@ function updateKeyedMap() {
|
|
|
155
155
|
// queue them for disposal at commit
|
|
156
156
|
for (i = o; i <= c; i++) {
|
|
157
157
|
f = this.Mt[i];
|
|
158
|
-
u = this.
|
|
158
|
+
u = this.Ut ? this.Ut(f) : f;
|
|
159
159
|
e = p.get(u);
|
|
160
160
|
if (e !== undefined && e !== -1) {
|
|
161
161
|
m[e] = this.xt[i];
|
|
162
|
-
_[e] = this.
|
|
163
|
-
r && (r[e] = this
|
|
164
|
-
n && (n[e] = this
|
|
162
|
+
_[e] = this.Gt[i];
|
|
163
|
+
r && (r[e] = this.$t[i]);
|
|
164
|
+
n && (n[e] = this.qt[i]);
|
|
165
165
|
e = w[e];
|
|
166
166
|
p.set(u, e);
|
|
167
|
-
} else (l ??= []).push(this.
|
|
167
|
+
} else (l ??= []).push(this.Gt[i]);
|
|
168
168
|
}
|
|
169
169
|
// 2) create new rows into the temp arrays; an abort disposes only these
|
|
170
170
|
try {
|
|
@@ -182,9 +182,9 @@ function updateKeyedMap() {
|
|
|
182
182
|
// change propagation), then dispose exited rows
|
|
183
183
|
for (i = 0; i < o; i++) {
|
|
184
184
|
m[i] = this.xt[i];
|
|
185
|
-
_[i] = this.
|
|
186
|
-
r && (r[i] = this
|
|
187
|
-
n && (n[i] = this
|
|
185
|
+
_[i] = this.Gt[i];
|
|
186
|
+
r && (r[i] = this.$t[i]);
|
|
187
|
+
n && (n[i] = this.qt[i]);
|
|
188
188
|
}
|
|
189
189
|
for (e = o; e <= a; e++) {
|
|
190
190
|
if (r) setSignal(r[e], t[e]);
|
|
@@ -192,20 +192,20 @@ function updateKeyedMap() {
|
|
|
192
192
|
}
|
|
193
193
|
for (e = a + 1; e < s; e++) {
|
|
194
194
|
m[e] = this.xt[e - O];
|
|
195
|
-
_[e] = this.
|
|
195
|
+
_[e] = this.Gt[e - O];
|
|
196
196
|
if (r) {
|
|
197
|
-
r[e] = this
|
|
197
|
+
r[e] = this.$t[e - O];
|
|
198
198
|
setSignal(r[e], t[e]);
|
|
199
199
|
}
|
|
200
200
|
if (n) {
|
|
201
|
-
n[e] = this
|
|
201
|
+
n[e] = this.qt[e - O];
|
|
202
202
|
if (O !== 0) setSignal(n[e], e);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
this.xt = m;
|
|
206
|
-
this.
|
|
207
|
-
r && (this
|
|
208
|
-
n && (this
|
|
206
|
+
this.Gt = _;
|
|
207
|
+
r && (this.$t = r);
|
|
208
|
+
n && (this.qt = n);
|
|
209
209
|
this.jt = s;
|
|
210
210
|
// save a copy of the mapped items for the next update
|
|
211
211
|
this.Mt = t.slice(0);
|
|
@@ -234,19 +234,19 @@ function updateKeyedMap() {
|
|
|
234
234
|
const r = {
|
|
235
235
|
wt: createOwner(),
|
|
236
236
|
jt: 0,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
Ht: 0,
|
|
238
|
+
Jt: t,
|
|
239
239
|
Kt: e,
|
|
240
|
-
|
|
240
|
+
Gt: [],
|
|
241
241
|
xt: [],
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
Vt: i?.from,
|
|
243
|
+
Bt: i?.fallback
|
|
244
244
|
};
|
|
245
245
|
const n = computed(updateRepeat.bind(r));
|
|
246
246
|
// Same as mapArray: untracked reads inside the internal owner resolve via
|
|
247
247
|
// _parentComputed, so async reads in row callbacks register with the node
|
|
248
248
|
// (pending tracking + post-settle retry) instead of vanishing.
|
|
249
|
-
r.wt.
|
|
249
|
+
r.wt.Tt = n;
|
|
250
250
|
n.T &= ~CONFIG_AUTO_DISPOSE;
|
|
251
251
|
return accessor(n);
|
|
252
252
|
}
|
|
@@ -259,37 +259,37 @@ function updateKeyedMap() {
|
|
|
259
259
|
// for the post-settle retry. The overlap math also subsumes the previous
|
|
260
260
|
// disjoint-window/front-clear/end-clear/shift special cases.
|
|
261
261
|
function updateRepeat() {
|
|
262
|
-
const t = this.
|
|
263
|
-
const s = this.
|
|
262
|
+
const t = this.Jt();
|
|
263
|
+
const s = this.Vt?.() || 0;
|
|
264
264
|
runWithOwner(this.wt, () => {
|
|
265
265
|
if (t === 0) {
|
|
266
266
|
if (this.jt !== 0) {
|
|
267
267
|
this.wt.dispose(false);
|
|
268
|
-
this.
|
|
268
|
+
this.Gt = [];
|
|
269
269
|
this.xt = [];
|
|
270
270
|
this.jt = 0;
|
|
271
271
|
// Reset offset to match the cleared data (#2767, repro 2).
|
|
272
|
-
this.
|
|
272
|
+
this.Ht = 0;
|
|
273
273
|
}
|
|
274
|
-
if (this.
|
|
274
|
+
if (this.Bt && !this.xt[0]) {
|
|
275
275
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
276
276
|
// dispose it before re-creating
|
|
277
|
-
this.
|
|
278
|
-
this.xt[0] = runWithOwner(this.
|
|
277
|
+
this.Gt[0]?.dispose();
|
|
278
|
+
this.xt[0] = runWithOwner(this.Gt[0] = createOwner(), this.Bt);
|
|
279
279
|
}
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
282
|
const i = s + t;
|
|
283
|
-
const e = this.
|
|
283
|
+
const e = this.Ht + this.jt;
|
|
284
284
|
// Retained overlap [keepStart, keepEnd) in global indexes; empty when the
|
|
285
285
|
// windows are disjoint or when coming from empty/fallback.
|
|
286
|
-
const r = Math.max(s, this.
|
|
286
|
+
const r = Math.max(s, this.Ht);
|
|
287
287
|
const n = Math.min(i, e);
|
|
288
288
|
const h = new Array(t);
|
|
289
289
|
const o = new Array(t);
|
|
290
290
|
for (let t = r; t < n; t++) {
|
|
291
|
-
o[t - s] = this.
|
|
292
|
-
h[t - s] = this.xt[t - this.
|
|
291
|
+
o[t - s] = this.Gt[t - this.Ht];
|
|
292
|
+
h[t - s] = this.xt[t - this.Ht];
|
|
293
293
|
}
|
|
294
294
|
try {
|
|
295
295
|
for (let t = s; t < i; t++) {
|
|
@@ -301,10 +301,10 @@ function updateRepeat() {
|
|
|
301
301
|
throw t;
|
|
302
302
|
}
|
|
303
303
|
// commit: dispose the previous fallback or the rows leaving the window
|
|
304
|
-
if (this.jt === 0) this.
|
|
304
|
+
if (this.jt === 0) this.Gt[0]?.dispose(); else for (let t = this.Ht; t < e; t++) if (t < s || t >= i) this.Gt[t - this.Ht].dispose();
|
|
305
305
|
this.xt = h;
|
|
306
|
-
this.
|
|
307
|
-
this.
|
|
306
|
+
this.Gt = o;
|
|
307
|
+
this.Ht = s;
|
|
308
308
|
this.jt = t;
|
|
309
309
|
});
|
|
310
310
|
return this.xt;
|
package/dist/prod/signals.js
CHANGED
|
@@ -277,7 +277,7 @@ function createEffect(e, t, n) {
|
|
|
277
277
|
// route through the inherited queue.
|
|
278
278
|
const r = getOwner();
|
|
279
279
|
const o = new MicrotaskQueue;
|
|
280
|
-
o.
|
|
280
|
+
o.ve = r.C;
|
|
281
281
|
// notify() forwards up the normal chain
|
|
282
282
|
r.C = o;
|
|
283
283
|
// A user effect rather than a bare computed: computeds are pull-based and
|