@solidjs/signals 2.0.0-rc.1 → 2.0.0-rc.2
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 +1661 -361
- package/dist/node.cjs +1939 -1331
- package/dist/prod/affects.js +16 -16
- package/dist/prod/boundaries.js +90 -90
- package/dist/prod/core/action.js +3 -3
- package/dist/prod/core/async.js +74 -72
- package/dist/prod/core/constants.js +39 -1
- package/dist/prod/core/core.js +332 -224
- package/dist/prod/core/effect.js +56 -56
- package/dist/prod/core/external.js +4 -4
- package/dist/prod/core/graph.js +65 -54
- package/dist/prod/core/heap.js +52 -44
- package/dist/prod/core/invariants.js +3 -2
- package/dist/prod/core/lanes.js +41 -34
- package/dist/prod/core/optimistic.js +63 -60
- package/dist/prod/core/owner.js +97 -96
- package/dist/prod/core/scheduler.js +243 -194
- package/dist/prod/core/verdict.js +184 -77
- package/dist/prod/map.js +104 -104
- package/dist/prod/signals.js +1 -1
- package/dist/prod/store/next/optimistic.js +31 -23
- package/dist/prod/store/next/projection.js +3 -3
- package/dist/prod/store/next/reconcile.js +78 -74
- package/dist/prod/store/next/store.js +357 -90
- package/dist/prod/store/store.js +7 -7
- package/dist/types/core/attribution-hooks.d.ts +52 -0
- package/dist/types/core/attribution.d.ts +186 -0
- package/dist/types/core/constants.d.ts +26 -0
- package/dist/types/core/core.d.ts +8 -1
- package/dist/types/core/dev.d.ts +20 -3
- package/dist/types/core/graph.d.ts +1 -0
- package/dist/types/core/lanes.d.ts +4 -16
- package/dist/types/core/scheduler.d.ts +8 -0
- package/dist/types/core/types.d.ts +85 -41
- package/dist/types/store/next/projection.d.ts +0 -16
- package/dist/types/store/next/store.d.ts +6 -0
- package/dist/types/store/next/target.d.ts +18 -0
- package/dist/types-cjs/core/attribution-hooks.d.cts +52 -0
- package/dist/types-cjs/core/attribution.d.cts +186 -0
- package/dist/types-cjs/core/constants.d.cts +26 -0
- package/dist/types-cjs/core/core.d.cts +8 -1
- package/dist/types-cjs/core/dev.d.cts +20 -3
- package/dist/types-cjs/core/graph.d.cts +1 -0
- package/dist/types-cjs/core/lanes.d.cts +4 -16
- package/dist/types-cjs/core/scheduler.d.cts +8 -0
- package/dist/types-cjs/core/types.d.cts +85 -41
- package/dist/types-cjs/store/next/projection.d.cts +0 -16
- package/dist/types-cjs/store/next/store.d.cts +6 -0
- package/dist/types-cjs/store/next/target.d.cts +18 -0
- package/package.json +1 -1
package/dist/prod/map.js
CHANGED
|
@@ -23,23 +23,23 @@ function mapArray(t, s, i) {
|
|
|
23
23
|
const r = s.length > 1;
|
|
24
24
|
const n = s;
|
|
25
25
|
const h = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Mt: [],
|
|
30
|
-
xt: n,
|
|
26
|
+
jt: createOwner(),
|
|
27
|
+
Wt: 0,
|
|
28
|
+
xt: t,
|
|
31
29
|
Kt: [],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
$t: n,
|
|
31
|
+
qt: [],
|
|
32
|
+
zt: [],
|
|
33
|
+
Jt: e,
|
|
34
|
+
Xt: e || i?.keyed === false ? [] : undefined,
|
|
35
|
+
Yt: r && i?.keyed !== false ? [] : undefined,
|
|
36
|
+
Zt: i?.keyed === false,
|
|
37
|
+
ts: i?.fallback
|
|
38
38
|
};
|
|
39
39
|
const o = computed(updateKeyedMap.bind(h));
|
|
40
40
|
// Untracked reads inside the internal owner resolve via _parentComputed; routing
|
|
41
41
|
// them through node lets store-proxy lookups see pending writes (not stale _value).
|
|
42
|
-
h.
|
|
42
|
+
h.jt.Ot = o;
|
|
43
43
|
o.T &= ~CONFIG_AUTO_DISPOSE;
|
|
44
44
|
return accessor(o);
|
|
45
45
|
}
|
|
@@ -58,52 +58,52 @@ const pureOptions = {
|
|
|
58
58
|
// strong-abort ordering: removed rows now dispose AFTER the pass's new rows
|
|
59
59
|
// are created (you cannot destroy state before knowing the pass will land).
|
|
60
60
|
function updateKeyedMap() {
|
|
61
|
-
const t = this.
|
|
61
|
+
const t = this.xt() || [], s = t.length;
|
|
62
62
|
t[$TRACK];
|
|
63
63
|
// top level tracking
|
|
64
|
-
runWithOwner(this.
|
|
64
|
+
runWithOwner(this.jt, () => {
|
|
65
65
|
let i, e, r, n,
|
|
66
66
|
// Mappers write freshly-created row/index signals into the STAGE
|
|
67
67
|
// arrays (`rows`/`indexes`), never into `this._rows`/`this._indexes`.
|
|
68
|
-
h = this
|
|
68
|
+
h = this.Xt ? this.Zt ? () => {
|
|
69
69
|
r[e] = signal(t[e], pureOptions);
|
|
70
|
-
return this
|
|
70
|
+
return this.$t(accessor(r[e]), e);
|
|
71
71
|
} : () => {
|
|
72
72
|
r[e] = signal(t[e], pureOptions);
|
|
73
73
|
n && (n[e] = signal(e, pureOptions));
|
|
74
|
-
return this
|
|
75
|
-
} : this.
|
|
74
|
+
return this.$t(accessor(r[e]), n ? accessor(n[e]) : undefined);
|
|
75
|
+
} : this.Yt ? () => {
|
|
76
76
|
const s = t[e];
|
|
77
77
|
n[e] = signal(e, pureOptions);
|
|
78
|
-
return this
|
|
78
|
+
return this.$t(s, accessor(n[e]));
|
|
79
79
|
} : () => {
|
|
80
80
|
const s = t[e];
|
|
81
|
-
return this
|
|
81
|
+
return this.$t(s);
|
|
82
82
|
};
|
|
83
83
|
// fast path for empty arrays
|
|
84
84
|
if (s === 0) {
|
|
85
|
-
if (this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.Mt = [];
|
|
85
|
+
if (this.Wt !== 0) {
|
|
86
|
+
this.jt.dispose(false);
|
|
87
|
+
this.zt = [];
|
|
89
88
|
this.Kt = [];
|
|
90
|
-
this.
|
|
91
|
-
this
|
|
92
|
-
this.
|
|
89
|
+
this.qt = [];
|
|
90
|
+
this.Wt = 0;
|
|
91
|
+
this.Xt && (this.Xt = []);
|
|
92
|
+
this.Yt && (this.Yt = []);
|
|
93
93
|
}
|
|
94
|
-
if (this.
|
|
94
|
+
if (this.ts && !this.qt[0]) {
|
|
95
95
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
96
96
|
// dispose it before re-creating
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
97
|
+
this.zt[0]?.dispose();
|
|
98
|
+
this.qt[0] = runWithOwner(this.zt[0] = createOwner(), this.ts);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
// fast path for new create
|
|
102
|
-
else if (this.
|
|
102
|
+
else if (this.Wt === 0) {
|
|
103
103
|
const o = new Array(s);
|
|
104
104
|
const c = new Array(s);
|
|
105
|
-
r = this
|
|
106
|
-
n = this.
|
|
105
|
+
r = this.Xt && new Array(s);
|
|
106
|
+
n = this.Yt && new Array(s);
|
|
107
107
|
try {
|
|
108
108
|
for (e = 0; e < s; e++) o[e] = runWithOwner(c[e] = createOwner(), h);
|
|
109
109
|
} catch (t) {
|
|
@@ -111,43 +111,43 @@ function updateKeyedMap() {
|
|
|
111
111
|
throw t;
|
|
112
112
|
}
|
|
113
113
|
// commit
|
|
114
|
-
if (this.
|
|
114
|
+
if (this.zt[0]) this.zt[0].dispose();
|
|
115
115
|
// previous fallback
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
118
|
-
r && (this
|
|
119
|
-
n && (this.
|
|
120
|
-
this.
|
|
121
|
-
this.
|
|
116
|
+
this.qt = o;
|
|
117
|
+
this.zt = c;
|
|
118
|
+
r && (this.Xt = r);
|
|
119
|
+
n && (this.Yt = n);
|
|
120
|
+
this.Kt = t.slice(0);
|
|
121
|
+
this.Wt = s;
|
|
122
122
|
} else {
|
|
123
123
|
let o, c, a, f, u, p, w, l, d;
|
|
124
124
|
// skip common prefix
|
|
125
|
-
for (o = 0, c = Math.min(this.
|
|
126
|
-
if (this
|
|
125
|
+
for (o = 0, c = Math.min(this.Wt, s); o < c && (this.Kt[o] === t[o] || this.Xt && compare(this.Jt, this.Kt[o], t[o])); o++) {
|
|
126
|
+
if (this.Xt) setSignal(this.Xt[o], t[o]);
|
|
127
127
|
}
|
|
128
128
|
// skip common suffix — counted only; retained entries land in one pass
|
|
129
129
|
// at commit instead of being staged and copied twice
|
|
130
|
-
for (c = this.
|
|
130
|
+
for (c = this.Wt - 1, a = s - 1; c >= o && a >= o && (this.Kt[c] === t[a] || this.Xt && compare(this.Jt, this.Kt[c], t[a])); c--,
|
|
131
131
|
a--) ;
|
|
132
132
|
// no structural change (every position matched in place at equal
|
|
133
133
|
// length — the common post-reconcile shape): keep the same mapped
|
|
134
134
|
// array identity so downstream consumers don't re-run at all
|
|
135
|
-
if (o === s && this.
|
|
136
|
-
this.
|
|
135
|
+
if (o === s && this.Wt === s) {
|
|
136
|
+
this.Kt = t.slice(0);
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
const O = s - this.
|
|
139
|
+
const O = s - this.Wt;
|
|
140
140
|
const m = new Array(s);
|
|
141
141
|
const _ = new Array(s);
|
|
142
|
-
r = this
|
|
143
|
-
n = this.
|
|
142
|
+
r = this.Xt ? new Array(s) : undefined;
|
|
143
|
+
n = this.Yt ? new Array(s) : undefined;
|
|
144
144
|
// 0) prepare a map of all indices in the changed window of newItems,
|
|
145
145
|
// scanning backwards so we encounter them in natural order
|
|
146
146
|
p = new Map;
|
|
147
147
|
w = new Array(a + 1);
|
|
148
148
|
for (e = a; e >= o; e--) {
|
|
149
149
|
f = t[e];
|
|
150
|
-
u = this.
|
|
150
|
+
u = this.Jt ? this.Jt(f) : f;
|
|
151
151
|
i = p.get(u);
|
|
152
152
|
w[e] = i === undefined ? -1 : i;
|
|
153
153
|
p.set(u, e);
|
|
@@ -156,17 +156,17 @@ function updateKeyedMap() {
|
|
|
156
156
|
// in the new set; if so, stage them at their new positions; if not,
|
|
157
157
|
// queue them for disposal at commit
|
|
158
158
|
for (i = o; i <= c; i++) {
|
|
159
|
-
f = this.
|
|
160
|
-
u = this.
|
|
159
|
+
f = this.Kt[i];
|
|
160
|
+
u = this.Jt ? this.Jt(f) : f;
|
|
161
161
|
e = p.get(u);
|
|
162
162
|
if (e !== undefined && e !== -1) {
|
|
163
|
-
m[e] = this.
|
|
164
|
-
_[e] = this.
|
|
165
|
-
r && (r[e] = this
|
|
166
|
-
n && (n[e] = this.
|
|
163
|
+
m[e] = this.qt[i];
|
|
164
|
+
_[e] = this.zt[i];
|
|
165
|
+
r && (r[e] = this.Xt[i]);
|
|
166
|
+
n && (n[e] = this.Yt[i]);
|
|
167
167
|
e = w[e];
|
|
168
168
|
p.set(u, e);
|
|
169
|
-
} else (l ??= []).push(this.
|
|
169
|
+
} else (l ??= []).push(this.zt[i]);
|
|
170
170
|
}
|
|
171
171
|
// 2) create new rows into the temp arrays; an abort disposes only these
|
|
172
172
|
try {
|
|
@@ -183,38 +183,38 @@ function updateKeyedMap() {
|
|
|
183
183
|
// into the fresh arrays, swap them in (new identity for downstream
|
|
184
184
|
// change propagation), then dispose exited rows
|
|
185
185
|
for (i = 0; i < o; i++) {
|
|
186
|
-
m[i] = this.
|
|
187
|
-
_[i] = this.
|
|
188
|
-
r && (r[i] = this
|
|
189
|
-
n && (n[i] = this.
|
|
186
|
+
m[i] = this.qt[i];
|
|
187
|
+
_[i] = this.zt[i];
|
|
188
|
+
r && (r[i] = this.Xt[i]);
|
|
189
|
+
n && (n[i] = this.Yt[i]);
|
|
190
190
|
}
|
|
191
191
|
for (e = o; e <= a; e++) {
|
|
192
192
|
if (r) setSignal(r[e], t[e]);
|
|
193
193
|
if (n) setSignal(n[e], e);
|
|
194
194
|
}
|
|
195
195
|
for (e = a + 1; e < s; e++) {
|
|
196
|
-
m[e] = this.
|
|
197
|
-
_[e] = this.
|
|
196
|
+
m[e] = this.qt[e - O];
|
|
197
|
+
_[e] = this.zt[e - O];
|
|
198
198
|
if (r) {
|
|
199
|
-
r[e] = this
|
|
199
|
+
r[e] = this.Xt[e - O];
|
|
200
200
|
setSignal(r[e], t[e]);
|
|
201
201
|
}
|
|
202
202
|
if (n) {
|
|
203
|
-
n[e] = this.
|
|
203
|
+
n[e] = this.Yt[e - O];
|
|
204
204
|
if (O !== 0) setSignal(n[e], e);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
this.
|
|
208
|
-
this.
|
|
209
|
-
r && (this
|
|
210
|
-
n && (this.
|
|
211
|
-
this.
|
|
207
|
+
this.qt = m;
|
|
208
|
+
this.zt = _;
|
|
209
|
+
r && (this.Xt = r);
|
|
210
|
+
n && (this.Yt = n);
|
|
211
|
+
this.Wt = s;
|
|
212
212
|
// save a copy of the mapped items for the next update
|
|
213
|
-
this.
|
|
213
|
+
this.Kt = t.slice(0);
|
|
214
214
|
if (l) for (i = 0; i < l.length; i++) l[i].dispose();
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
|
-
return this.
|
|
217
|
+
return this.qt;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
/**
|
|
@@ -234,21 +234,21 @@ function updateKeyedMap() {
|
|
|
234
234
|
*/ function repeat(t, s, i) {
|
|
235
235
|
const e = s;
|
|
236
236
|
const r = {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
jt: createOwner(),
|
|
238
|
+
Wt: 0,
|
|
239
|
+
ss: 0,
|
|
240
|
+
es: t,
|
|
241
|
+
$t: e,
|
|
242
|
+
zt: [],
|
|
243
|
+
qt: [],
|
|
244
|
+
rs: i?.from,
|
|
245
|
+
ts: i?.fallback
|
|
246
246
|
};
|
|
247
247
|
const n = computed(updateRepeat.bind(r));
|
|
248
248
|
// Same as mapArray: untracked reads inside the internal owner resolve via
|
|
249
249
|
// _parentComputed, so async reads in row callbacks register with the node
|
|
250
250
|
// (pending tracking + post-settle retry) instead of vanishing.
|
|
251
|
-
r.
|
|
251
|
+
r.jt.Ot = n;
|
|
252
252
|
n.T &= ~CONFIG_AUTO_DISPOSE;
|
|
253
253
|
return accessor(n);
|
|
254
254
|
}
|
|
@@ -261,55 +261,55 @@ function updateKeyedMap() {
|
|
|
261
261
|
// for the post-settle retry. The overlap math also subsumes the previous
|
|
262
262
|
// disjoint-window/front-clear/end-clear/shift special cases.
|
|
263
263
|
function updateRepeat() {
|
|
264
|
-
const t = this.
|
|
265
|
-
const s = this.
|
|
266
|
-
runWithOwner(this.
|
|
264
|
+
const t = this.es();
|
|
265
|
+
const s = this.rs?.() || 0;
|
|
266
|
+
runWithOwner(this.jt, () => {
|
|
267
267
|
if (t === 0) {
|
|
268
|
-
if (this.
|
|
269
|
-
this.
|
|
270
|
-
this.
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
268
|
+
if (this.Wt !== 0) {
|
|
269
|
+
this.jt.dispose(false);
|
|
270
|
+
this.zt = [];
|
|
271
|
+
this.qt = [];
|
|
272
|
+
this.Wt = 0;
|
|
273
273
|
// Reset offset to match the cleared data (#2767, repro 2).
|
|
274
|
-
this.
|
|
274
|
+
this.ss = 0;
|
|
275
275
|
}
|
|
276
|
-
if (this.
|
|
276
|
+
if (this.ts && !this.qt[0]) {
|
|
277
277
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
278
278
|
// dispose it before re-creating
|
|
279
|
-
this.
|
|
280
|
-
this.
|
|
279
|
+
this.zt[0]?.dispose();
|
|
280
|
+
this.qt[0] = runWithOwner(this.zt[0] = createOwner(), this.ts);
|
|
281
281
|
}
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
const i = s + t;
|
|
285
|
-
const e = this.
|
|
285
|
+
const e = this.ss + this.Wt;
|
|
286
286
|
// Retained overlap [keepStart, keepEnd) in global indexes; empty when the
|
|
287
287
|
// windows are disjoint or when coming from empty/fallback.
|
|
288
|
-
const r = Math.max(s, this.
|
|
288
|
+
const r = Math.max(s, this.ss);
|
|
289
289
|
const n = Math.min(i, e);
|
|
290
290
|
const h = new Array(t);
|
|
291
291
|
const o = new Array(t);
|
|
292
292
|
for (let t = r; t < n; t++) {
|
|
293
|
-
o[t - s] = this.
|
|
294
|
-
h[t - s] = this.
|
|
293
|
+
o[t - s] = this.zt[t - this.ss];
|
|
294
|
+
h[t - s] = this.qt[t - this.ss];
|
|
295
295
|
}
|
|
296
296
|
try {
|
|
297
297
|
for (let t = s; t < i; t++) {
|
|
298
298
|
if (t >= r && t < n) continue;
|
|
299
|
-
h[t - s] = runWithOwner(o[t - s] = createOwner(), () => this
|
|
299
|
+
h[t - s] = runWithOwner(o[t - s] = createOwner(), () => this.$t(t));
|
|
300
300
|
}
|
|
301
301
|
} catch (t) {
|
|
302
302
|
for (let t = s; t < i; t++) if ((t < r || t >= n) && o[t - s]) o[t - s].dispose();
|
|
303
303
|
throw t;
|
|
304
304
|
}
|
|
305
305
|
// commit: dispose the previous fallback or the rows leaving the window
|
|
306
|
-
if (this.
|
|
307
|
-
this.
|
|
308
|
-
this.
|
|
309
|
-
this.
|
|
310
|
-
this.
|
|
306
|
+
if (this.Wt === 0) this.zt[0]?.dispose(); else for (let t = this.ss; t < e; t++) if (t < s || t >= i) this.zt[t - this.ss].dispose();
|
|
307
|
+
this.qt = h;
|
|
308
|
+
this.zt = o;
|
|
309
|
+
this.ss = s;
|
|
310
|
+
this.Wt = t;
|
|
311
311
|
});
|
|
312
|
-
return this.
|
|
312
|
+
return this.qt;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
function compare(t, s, i) {
|
package/dist/prod/signals.js
CHANGED
|
@@ -251,7 +251,7 @@ function createEffect(e, t, n) {
|
|
|
251
251
|
// route through the inherited queue.
|
|
252
252
|
const r = getOwner();
|
|
253
253
|
const o = new MicrotaskQueue;
|
|
254
|
-
o.
|
|
254
|
+
o.ve = r.C;
|
|
255
255
|
// notify() forwards up the normal chain
|
|
256
256
|
r.C = o;
|
|
257
257
|
// A user effect rather than a bare computed: computeds are pull-based and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, ext, setSignal, isEqual } from "../../core/core.js";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CONFIG_AUTO_DISPOSE, STATUS_PENDING, NOT_PENDING, unwrapOverride, CONFIG_OPTIMISTIC } from "../../core/constants.js";
|
|
4
4
|
|
|
5
5
|
import { GlobalQueue, insertSubs, schedule, globalQueue } from "../../core/scheduler.js";
|
|
6
6
|
|
|
@@ -51,14 +51,14 @@ function installNextBlockedHalf() {
|
|
|
51
51
|
// Scheduler flush tails call _clearOptimisticStores whenever tracked
|
|
52
52
|
// stores exist; next has no layer to clear — reverts are engine-native —
|
|
53
53
|
// so the hook only empties the batch set.
|
|
54
|
-
if (!GlobalQueue.
|
|
55
|
-
GlobalQueue.
|
|
54
|
+
if (!GlobalQueue.Vt) {
|
|
55
|
+
GlobalQueue.Vt = e => {
|
|
56
56
|
e.clear();
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
const e = GlobalQueue.
|
|
60
|
-
GlobalQueue.
|
|
61
|
-
for (const e of t.
|
|
59
|
+
const e = GlobalQueue.dn;
|
|
60
|
+
GlobalQueue.dn = t => {
|
|
61
|
+
for (const e of t.cn) {
|
|
62
62
|
const t = e?.[$TARGET];
|
|
63
63
|
const n = t?.fam?.node;
|
|
64
64
|
// The hold exists to keep optimistic state alive until the store's own
|
|
@@ -80,10 +80,10 @@ function familyHasLiveOverrides(e) {
|
|
|
80
80
|
if (t === null) continue;
|
|
81
81
|
for (const e of Reflect.ownKeys(t)) {
|
|
82
82
|
const n = t[e];
|
|
83
|
-
if (n.De !== undefined && n.De !== NOT_PENDING) return true;
|
|
83
|
+
if (n.o?.De !== undefined && n.o?.De !== NOT_PENDING) return true;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
if (e.k !== null && e.k.De !== undefined && e.k.De !== NOT_PENDING) return true;
|
|
86
|
+
if (e.k !== null && e.k.o?.De !== undefined && e.k.o?.De !== NOT_PENDING) return true;
|
|
87
87
|
}
|
|
88
88
|
t.clear();
|
|
89
89
|
// nothing live — drop the bookkeeping
|
|
@@ -146,15 +146,15 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
146
146
|
// at plain flush end. The blocked-check store-half keeps that transaction
|
|
147
147
|
// from settling while the firewall is pending.
|
|
148
148
|
const n = e.fam?.node;
|
|
149
|
-
if (n?.
|
|
149
|
+
if (n?._e) globalQueue.initTransition(n._e);
|
|
150
150
|
const i = e.v;
|
|
151
151
|
const visible = (t, n) => {
|
|
152
152
|
const i = e.n?.[t];
|
|
153
|
-
return i !== undefined && hasActiveOverride(i) ? unwrapOverride(i.De) : n;
|
|
153
|
+
return i !== undefined && hasActiveOverride(i) ? unwrapOverride(i.o?.De) : n;
|
|
154
154
|
};
|
|
155
155
|
const visiblePresent = t => {
|
|
156
156
|
const n = e.h?.[t];
|
|
157
|
-
return n !== undefined && hasActiveOverride(n) ? !!unwrapOverride(n.De) : t in i;
|
|
157
|
+
return n !== undefined && hasActiveOverride(n) ? !!unwrapOverride(n.o?.De) : t in i;
|
|
158
158
|
};
|
|
159
159
|
let o = false;
|
|
160
160
|
const r = Array.isArray(t);
|
|
@@ -198,7 +198,7 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
198
198
|
// and the target for landing consumption (RUL-2).
|
|
199
199
|
e.pb = null;
|
|
200
200
|
(e.fam.overlaid ??= new Set).add(e);
|
|
201
|
-
GlobalQueue.
|
|
201
|
+
GlobalQueue.Nn?.(e.fam.px ?? e.px);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
@@ -214,15 +214,19 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
214
214
|
for (const e of t) {
|
|
215
215
|
const drop = (e, t) => {
|
|
216
216
|
if (!hasActiveOverride(e)) return;
|
|
217
|
-
const n = unwrapOverride(e.De);
|
|
217
|
+
const n = unwrapOverride(e.o?.De);
|
|
218
218
|
// Full legacy reset (clearOptimisticOverride parity): the landing is
|
|
219
219
|
// authoritative NOW — fold committed into the node directly instead
|
|
220
220
|
// of riding a transaction's commit (whose queues may be stashed with
|
|
221
221
|
// the transaction parked; the wake would strand until it settles).
|
|
222
|
-
e.De = NOT_PENDING;
|
|
223
|
-
e.
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
ext(e).De = NOT_PENDING;
|
|
223
|
+
e.T |= CONFIG_OPTIMISTIC;
|
|
224
|
+
const i = e.o;
|
|
225
|
+
if (i) {
|
|
226
|
+
i.Et = null;
|
|
227
|
+
i.Be = undefined;
|
|
228
|
+
}
|
|
229
|
+
e.Pe = NOT_PENDING;
|
|
226
230
|
e.be = t;
|
|
227
231
|
if (!e.Ue || !e.Ue(n, t)) {
|
|
228
232
|
insertSubs(e, true);
|
|
@@ -256,9 +260,13 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
256
260
|
for (const t of Reflect.ownKeys(n)) drop(n[t], t in e.v);
|
|
257
261
|
}
|
|
258
262
|
if (e.k !== null && hasActiveOverride(e.k)) {
|
|
259
|
-
e.k.De = NOT_PENDING;
|
|
260
|
-
e.k.
|
|
261
|
-
e.k.
|
|
263
|
+
ext(e.k).De = NOT_PENDING;
|
|
264
|
+
e.k.T |= CONFIG_OPTIMISTIC;
|
|
265
|
+
const t = e.k.o;
|
|
266
|
+
if (t) {
|
|
267
|
+
t.Et = null;
|
|
268
|
+
t.Be = undefined;
|
|
269
|
+
}
|
|
262
270
|
insertSubs(e.k, true);
|
|
263
271
|
schedule();
|
|
264
272
|
}
|
|
@@ -280,7 +288,7 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
280
288
|
for (const e of Reflect.ownKeys(i)) {
|
|
281
289
|
const n = i[e];
|
|
282
290
|
if (!hasActiveOverride(n)) continue;
|
|
283
|
-
const o = unwrapOverride(n.De);
|
|
291
|
+
const o = unwrapOverride(n.o?.De);
|
|
284
292
|
if (e === "length" && Array.isArray(t)) {
|
|
285
293
|
if (t.length !== o) ensure().length = o;
|
|
286
294
|
} else if (!isEqual(t[e], o)) ensure()[e] = o;
|
|
@@ -291,7 +299,7 @@ function createOptimisticStoreNext(e, t, n) {
|
|
|
291
299
|
for (const e of Reflect.ownKeys(o)) {
|
|
292
300
|
const i = o[e];
|
|
293
301
|
if (!hasActiveOverride(i)) continue;
|
|
294
|
-
const r = !!unwrapOverride(i.De);
|
|
302
|
+
const r = !!unwrapOverride(i.o?.De);
|
|
295
303
|
if (!r && e in (n ?? t)) delete ensure()[e];
|
|
296
304
|
}
|
|
297
305
|
}
|
|
@@ -149,8 +149,8 @@ function runProjectionComputedNext(e, t, r, o, i) {
|
|
|
149
149
|
// for the whole first flight — the derive works a detached shadow of the
|
|
150
150
|
// seed so draft writes cannot tear through to readers (#2988). Every commit
|
|
151
151
|
// point reconciles the shadow through the normal commit path.
|
|
152
|
-
const u = n.
|
|
153
|
-
const l = new Proxy(e, createWriteTraps(() => !c || n.
|
|
152
|
+
const u = n.Ie ? JSON.parse(JSON.stringify(e[$TARGET][STORE_VALUE])) : null;
|
|
153
|
+
const l = new Proxy(e, createWriteTraps(() => !c || n.o?.Ee === s, i));
|
|
154
154
|
storeSetterNext(l, i => {
|
|
155
155
|
s = t(u ?? i);
|
|
156
156
|
c = true;
|
|
@@ -164,7 +164,7 @@ function runProjectionComputedNext(e, t, r, o, i) {
|
|
|
164
164
|
o ? o(write) : write();
|
|
165
165
|
};
|
|
166
166
|
const l = handleAsync(n, s, commit);
|
|
167
|
-
if (!n.
|
|
167
|
+
if (!n.Ie) commit(l);
|
|
168
168
|
}, false);
|
|
169
169
|
return n;
|
|
170
170
|
}
|