@solidjs/signals 2.0.0-rc.14 → 2.0.0-rc.16
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 +882 -405
- package/dist/dev.attribution.js +172 -66
- package/dist/dev.js +1529 -745
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +32 -80
- package/dist/observe/boundaries.js +202 -166
- package/dist/observe/core/async.js +192 -141
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +315 -214
- package/dist/observe/core/constants.js +23 -4
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +532 -360
- package/dist/observe/core/dev.js +63 -35
- package/dist/observe/core/effect.js +47 -47
- package/dist/observe/core/error.js +5 -3
- package/dist/observe/core/external.js +5 -6
- package/dist/observe/core/graph.js +56 -42
- package/dist/observe/core/heap.js +33 -33
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/lanes.js +242 -229
- package/dist/observe/core/owner.js +62 -50
- package/dist/observe/core/scheduler.js +322 -168
- package/dist/observe/core/truth.js +45 -0
- package/dist/observe/core/verdict.js +114 -64
- package/dist/observe/deferred.js +184 -0
- package/dist/observe/index.js +7 -1
- package/dist/observe/map.js +339 -254
- package/dist/observe/reveal.js +77 -77
- package/dist/observe/signals.js +54 -33
- package/dist/observe/store/affects.js +76 -69
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +0 -2
- package/dist/observe/store/optimistic.js +82 -44
- package/dist/observe/store/projection.js +83 -64
- package/dist/observe/store/reconcile.js +32 -30
- package/dist/observe/store/store.js +219 -123
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +33 -79
- package/dist/prod/boundaries.js +185 -149
- package/dist/prod/core/async.js +176 -135
- package/dist/prod/core/constants.js +23 -4
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +521 -353
- package/dist/prod/core/effect.js +66 -66
- package/dist/prod/core/error.js +5 -3
- package/dist/prod/core/external.js +5 -6
- package/dist/prod/core/graph.js +56 -42
- package/dist/prod/core/heap.js +38 -38
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/lanes.js +237 -224
- package/dist/prod/core/owner.js +62 -51
- package/dist/prod/core/scheduler.js +312 -158
- package/dist/prod/core/truth.js +45 -0
- package/dist/prod/core/verdict.js +113 -63
- package/dist/prod/deferred.js +182 -0
- package/dist/prod/index.js +7 -1
- package/dist/prod/map.js +366 -281
- package/dist/prod/reveal.js +77 -77
- package/dist/prod/signals.js +59 -38
- package/dist/prod/store/affects.js +76 -69
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +0 -2
- package/dist/prod/store/optimistic.js +121 -84
- package/dist/prod/store/projection.js +46 -34
- package/dist/prod/store/reconcile.js +32 -30
- package/dist/prod/store/store.js +205 -116
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/boundaries.d.ts +5 -1
- package/dist/types/core/async.d.ts +10 -0
- package/dist/types/core/attribution.d.ts +6 -2
- package/dist/types/core/constants.d.ts +18 -1
- package/dist/types/core/core.d.ts +77 -5
- package/dist/types/core/dev.d.ts +43 -13
- package/dist/types/core/graph.d.ts +11 -0
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +2 -1
- package/dist/types/core/lanes.d.ts +2 -4
- package/dist/types/core/owner.d.ts +5 -3
- package/dist/types/core/scheduler.d.ts +59 -34
- package/dist/types/core/truth.d.ts +16 -0
- package/dist/types/core/types.d.ts +21 -6
- package/dist/types/core/verdict.d.ts +32 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/map.d.ts +2 -2
- package/dist/types/signals.d.ts +28 -7
- package/dist/types/store/affects.d.ts +11 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +10 -4
- package/dist/types/store/optimistic.d.ts +3 -2
- package/dist/types/store/projection.d.ts +4 -3
- package/dist/types/store/store.d.ts +4 -39
- package/dist/types/store/target.d.ts +16 -8
- package/dist/types/store/types.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CONFIG_SLOT_NODE } from "../core/constants.js";
|
|
2
|
+
|
|
3
|
+
import { signalName } from "../core/identities.js";
|
|
4
|
+
|
|
5
|
+
import { $TARGET } from "./types.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Deferred hydration, dependency edges for stores. Only the frames client
|
|
9
|
+
* imports this module, so nothing here ships without it.
|
|
10
|
+
*
|
|
11
|
+
* A plain store root (`createStore` over an object) is named like a plain
|
|
12
|
+
* signal (core/identities.ts: `<owner id>~<n>`, on the same count), and the
|
|
13
|
+
* whole store goes by that one name: the server records it for any read of
|
|
14
|
+
* the store, at any depth, and a setter call on the store — on its root or
|
|
15
|
+
* on a proxy nested in it — is a write to it. Its readers mount at the
|
|
16
|
+
* setter's entry, before the draft runs, as a plain signal's do.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @internal The name of the store `x` belongs to — `x` a store proxy (a
|
|
20
|
+
* setter's entry) or one of its property nodes (the setter notifying it) —
|
|
21
|
+
* or undefined when it has none or it cannot be placed: a projection or
|
|
22
|
+
* optimistic family, a store chained over another store's proxy, a root
|
|
23
|
+
* named twice, or a proxy reached through a store other than the one it
|
|
24
|
+
* was named as the root of.
|
|
25
|
+
*/ function storeName(e) {
|
|
26
|
+
if (e === undefined) return undefined;
|
|
27
|
+
let n = e.l & CONFIG_SLOT_NODE ? e.O : e[$TARGET];
|
|
28
|
+
if (n === undefined) return undefined;
|
|
29
|
+
// Up to the root; a target on the way named as a root of its own is one
|
|
30
|
+
// object in two stores.
|
|
31
|
+
while (n.u !== null) {
|
|
32
|
+
if (n.fam !== null || n.ch || signalName(n) !== undefined) return undefined;
|
|
33
|
+
n = n.u;
|
|
34
|
+
}
|
|
35
|
+
if (n.fam !== null || n.ch) return undefined;
|
|
36
|
+
return signalName(n) || undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { storeName };
|
|
@@ -2,8 +2,6 @@ import { createStore as createStore$1, deep as deep$1, snapshot as snapshot$1 }
|
|
|
2
2
|
|
|
3
3
|
export { storeHasFamily, storeHasOptimisticFamily, storeIsShallow } from "./store.js";
|
|
4
4
|
|
|
5
|
-
import "./affects.js";
|
|
6
|
-
|
|
7
5
|
export { createOptimisticStore } from "./optimistic.js";
|
|
8
6
|
|
|
9
7
|
import { createStoreDerived } from "./projection.js";
|
|
@@ -2,7 +2,7 @@ import { CONFIG_OVERRIDE, CONFIG_AUTO_DISPOSE, NOT_PENDING } from "../core/const
|
|
|
2
2
|
|
|
3
3
|
import { computed, ext, untrack, read, isEqual } from "../core/core.js";
|
|
4
4
|
|
|
5
|
-
import { pendingGuessOf,
|
|
5
|
+
import { pendingGuessOf, optimisticWrite } from "../core/lanes.js";
|
|
6
6
|
|
|
7
7
|
import { getOwner } from "../core/owner.js";
|
|
8
8
|
|
|
@@ -10,12 +10,16 @@ import { GlobalQueue, txOf, list, insertSubs, laneDirty, notifyEpoch, schedule }
|
|
|
10
10
|
|
|
11
11
|
import { runProjectionComputed } from "./projection.js";
|
|
12
12
|
|
|
13
|
-
import { wrap, nameStore, storeSetter, LaneView, committed, getNode, unwrapValue, sameKey,
|
|
13
|
+
import { wrap, nameStore, storeSetter, LaneView, committed, getNode, unwrapValue, sameKey, resolveChainedRaw, getHasNode, targetsEqual, getContainerNode, cloneRaw } from "./store.js";
|
|
14
|
+
|
|
15
|
+
import { installOptHooks } from "./hooks.js";
|
|
14
16
|
|
|
15
17
|
import { $OWNER } from "./target.js";
|
|
16
18
|
|
|
17
19
|
import { $TARGET, markRawIngest, $TRACK, isWrappable } from "./types.js";
|
|
18
20
|
|
|
21
|
+
import { laneValueOf } from "../core/truth.js";
|
|
22
|
+
|
|
19
23
|
/**
|
|
20
24
|
* Store — optimistic stores on lanes (plan sec. 31, S4; INTERNALS §3/§7, RUL-3).
|
|
21
25
|
*
|
|
@@ -79,7 +83,7 @@ function notifyOptimisticWrites(e, n) {
|
|
|
79
83
|
// inner store's truth for its key before guessing over it.
|
|
80
84
|
const o = e.ch ? e.v : null;
|
|
81
85
|
const guess = (e, n, i, r) => {
|
|
82
|
-
if (o !== null) e.
|
|
86
|
+
if (o !== null) e.Ie = i ? n in t : unwrapValue(t[n]);
|
|
83
87
|
// By value: a function leaf is a value, not an updater (#3017).
|
|
84
88
|
optimisticWrite(e, () => r);
|
|
85
89
|
};
|
|
@@ -157,9 +161,40 @@ function rowSame(e, n, t) {
|
|
|
157
161
|
if (t === null || !isWrappable(e) || !isWrappable(n)) return false;
|
|
158
162
|
const i = t(unwrapValue(e));
|
|
159
163
|
const r = t(unwrapValue(n));
|
|
164
|
+
// Keyless rows are identified by position — reconcile's fallback when the
|
|
165
|
+
// key is missing. The caller already paired these by index, so two keyless
|
|
166
|
+
// rows are the same row and the landing confirms the arrangement instead of
|
|
167
|
+
// dissolving it. Dissolving held an external echo under the action, and a
|
|
168
|
+
// mainline `until` then timed out on a source that already contained it
|
|
169
|
+
// (#3898). Keyed rows still match only on the key.
|
|
170
|
+
if (i === undefined && r === undefined) return true;
|
|
160
171
|
return i !== undefined && sameKey(i, r);
|
|
161
172
|
}
|
|
162
173
|
|
|
174
|
+
/** Whether reconcile would write anything into `a` from `b`: wrappable
|
|
175
|
+
* pairs descend, leaves compare as its writes do. A key mismatch is a
|
|
176
|
+
* replacement, which a content difference already says. Plain data — the
|
|
177
|
+
* server's echo of a guessed row is a new object with the same contents. */ function echoes(e, n) {
|
|
178
|
+
if (e === n) return true;
|
|
179
|
+
if (!isWrappable(e) || !isWrappable(n)) return false;
|
|
180
|
+
e = unwrapValue(e);
|
|
181
|
+
n = unwrapValue(n);
|
|
182
|
+
const t = Object.keys(e);
|
|
183
|
+
if (Array.isArray(e) !== Array.isArray(n) || t.length !== Object.keys(n).length) return false;
|
|
184
|
+
for (const i of t) if (!hasOwn.call(n, i) || !echoes(e[i], n[i])) return false;
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// A cycle (a row that references itself) is not plain data: no match, so
|
|
189
|
+
// the landing stays a correction.
|
|
190
|
+
GlobalQueue.sn = (e, n) => {
|
|
191
|
+
try {
|
|
192
|
+
return echoes(e, n);
|
|
193
|
+
} catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
163
198
|
function arrangementEqual(e, n, t) {
|
|
164
199
|
if (Array.isArray(e) !== Array.isArray(n)) return false;
|
|
165
200
|
if (Array.isArray(e)) {
|
|
@@ -233,10 +268,10 @@ function arrangementEqual(e, n, t) {
|
|
|
233
268
|
* node is born for it as the lane's derivation), on `length` only when the
|
|
234
269
|
* committed length differs, and as the `LaneView`'s base for structural
|
|
235
270
|
* reads. Unkeyed families compose
|
|
236
|
-
* positionally — the guess stands as written (the documented residue). */ GlobalQueue.
|
|
237
|
-
const t = e.
|
|
238
|
-
if (t === undefined || e.
|
|
239
|
-
const i = e.
|
|
271
|
+
* positionally — the guess stands as written (the documented residue). */ GlobalQueue.an = (e, n) => {
|
|
272
|
+
const t = e.O;
|
|
273
|
+
if (t === undefined || e.Vt !== $TRACK) return;
|
|
274
|
+
const i = e.T.V;
|
|
240
275
|
if (!(i instanceof LaneView)) return;
|
|
241
276
|
if (!Array.isArray(n) || !Array.isArray(i.rows)) {
|
|
242
277
|
i.base = n;
|
|
@@ -262,15 +297,15 @@ function arrangementEqual(e, n, t) {
|
|
|
262
297
|
s.add(t);
|
|
263
298
|
} else a.push(n);
|
|
264
299
|
}
|
|
265
|
-
const
|
|
300
|
+
const u = i.removed;
|
|
266
301
|
for (let e = 0; e < n.length; e++) {
|
|
267
302
|
const t = n[e];
|
|
268
303
|
const i = isWrappable(t) ? r(t) : undefined;
|
|
269
|
-
if (i !== undefined && !s.has(i) && (
|
|
304
|
+
if (i !== undefined && !s.has(i) && (u === null || !u.has(i))) a.push(t);
|
|
270
305
|
}
|
|
271
306
|
i.rows = a;
|
|
272
307
|
i.base = a;
|
|
273
|
-
const
|
|
308
|
+
const l = txOf(e);
|
|
274
309
|
const c = committed(t);
|
|
275
310
|
const d = t.n;
|
|
276
311
|
for (let e = 0; e < a.length; e++) {
|
|
@@ -279,17 +314,17 @@ function arrangementEqual(e, n, t) {
|
|
|
279
314
|
// lane's only where the composed row is another row (by key — the same
|
|
280
315
|
// key's new object is the same row, its target adopted it).
|
|
281
316
|
if (n === undefined) {
|
|
282
|
-
if (!sameRow(c[e], a[e], r)) laneSet(getNode(t, e), a[e],
|
|
283
|
-
} else if (!sameRow(n.
|
|
317
|
+
if (!sameRow(c[e], a[e], r)) laneSet(getNode(t, e), a[e], l);
|
|
318
|
+
} else if (!sameRow(n.l & CONFIG_OVERRIDE ? n.T.V : c[e], a[e], r)) laneSet(n, a[e], l);
|
|
284
319
|
}
|
|
285
320
|
if (d !== null) {
|
|
286
321
|
for (let e = a.length; ;e++) {
|
|
287
322
|
const n = d[e];
|
|
288
323
|
if (n === undefined) break;
|
|
289
|
-
laneSet(n, undefined,
|
|
324
|
+
laneSet(n, undefined, l);
|
|
290
325
|
}
|
|
291
326
|
const e = d.length;
|
|
292
|
-
if (e !== undefined && (e.
|
|
327
|
+
if (e !== undefined && (e.l & CONFIG_OVERRIDE || c.length !== a.length)) laneSet(e, a.length, l);
|
|
293
328
|
}
|
|
294
329
|
};
|
|
295
330
|
|
|
@@ -304,12 +339,12 @@ function sameRow(e, n, t) {
|
|
|
304
339
|
* node that was not the lane's becomes its derivation (its committed value
|
|
305
340
|
* untouched beneath; the lane's end commits the latest). */ function laneSet(e, n, t) {
|
|
306
341
|
const i = ext(e);
|
|
307
|
-
if (!(e.
|
|
308
|
-
e.
|
|
342
|
+
if (!(e.l & CONFIG_OVERRIDE)) {
|
|
343
|
+
e.l |= CONFIG_OVERRIDE;
|
|
309
344
|
list(e, t);
|
|
310
|
-
} else if (i.
|
|
311
|
-
i.
|
|
312
|
-
if (e.
|
|
345
|
+
} else if (i.V === n) return;
|
|
346
|
+
i.V = n;
|
|
347
|
+
if (e.o !== null) {
|
|
313
348
|
insertSubs(e);
|
|
314
349
|
laneDirty(e, t);
|
|
315
350
|
}
|
|
@@ -354,7 +389,7 @@ function sweepOverlaid() {
|
|
|
354
389
|
// The container shows its backing again (a shown arrangement guess
|
|
355
390
|
// that ended without a landing left its `LaneView` as the value).
|
|
356
391
|
const t = e.k;
|
|
357
|
-
if (t !== null && t.
|
|
392
|
+
if (t !== null && t.Ie instanceof LaneView) t.Ie = t.Ie.base;
|
|
358
393
|
}
|
|
359
394
|
if (n.size === 0) overlaidFamilies.delete(e);
|
|
360
395
|
}
|
|
@@ -371,11 +406,11 @@ function sweepOverlaid() {
|
|
|
371
406
|
if (i !== null) for (const e of Reflect.ownKeys(i)) {
|
|
372
407
|
const r = i[e];
|
|
373
408
|
const o = untrack(() => unwrapValue(n[e]));
|
|
374
|
-
if (r.
|
|
375
|
-
r.
|
|
409
|
+
if (r.Ye && r.Ye(r.Ie, o)) continue;
|
|
410
|
+
r.Ie = o;
|
|
376
411
|
// (The lane's end notified it this epoch when the shown value and the
|
|
377
412
|
// covered one differed — its readers re-derive already.)
|
|
378
|
-
if (r.
|
|
413
|
+
if (r.o !== null && r.Ot !== notifyEpoch) {
|
|
379
414
|
insertSubs(r);
|
|
380
415
|
t = true;
|
|
381
416
|
}
|
|
@@ -384,9 +419,9 @@ function sweepOverlaid() {
|
|
|
384
419
|
if (r !== null) for (const e of Reflect.ownKeys(r)) {
|
|
385
420
|
const i = r[e];
|
|
386
421
|
const o = untrack(() => e in n);
|
|
387
|
-
if (i.
|
|
388
|
-
i.
|
|
389
|
-
if (i.
|
|
422
|
+
if (i.Ie === o) continue;
|
|
423
|
+
i.Ie = o;
|
|
424
|
+
if (i.o !== null && i.Ot !== notifyEpoch) {
|
|
390
425
|
insertSubs(i);
|
|
391
426
|
t = true;
|
|
392
427
|
}
|
|
@@ -394,9 +429,9 @@ function sweepOverlaid() {
|
|
|
394
429
|
// The arrangement the readers saw (the shown guess) against the inner's
|
|
395
430
|
// now: a structural reader re-derives when they differ.
|
|
396
431
|
const o = e.k;
|
|
397
|
-
if (o !== null && o.
|
|
432
|
+
if (o !== null && o.o !== null && o.Ie instanceof LaneView && o.Ot !== notifyEpoch) {
|
|
398
433
|
const i = Array.isArray(n) ? untrack(() => n.map(unwrapValue)) : n;
|
|
399
|
-
if (!arrangementEqual(o.
|
|
434
|
+
if (!arrangementEqual(o.Ie.rows, i, e.fam?.key ?? null)) {
|
|
400
435
|
insertSubs(o);
|
|
401
436
|
t = true;
|
|
402
437
|
}
|
|
@@ -405,12 +440,12 @@ function sweepOverlaid() {
|
|
|
405
440
|
}
|
|
406
441
|
|
|
407
442
|
function carriesLane(e) {
|
|
408
|
-
if (e.k !== null && e.k.
|
|
409
|
-
if (e.dk !== null && e.dk.
|
|
443
|
+
if (e.k !== null && e.k.l & CONFIG_OVERRIDE) return true;
|
|
444
|
+
if (e.dk !== null && e.dk.l & CONFIG_OVERRIDE) return true;
|
|
410
445
|
const n = e.n;
|
|
411
|
-
if (n !== null) for (const e of Reflect.ownKeys(n)) if (n[e].
|
|
446
|
+
if (n !== null) for (const e of Reflect.ownKeys(n)) if (n[e].l & CONFIG_OVERRIDE) return true;
|
|
412
447
|
const t = e.h;
|
|
413
|
-
if (t !== null) for (const e of Reflect.ownKeys(t)) if (t[e].
|
|
448
|
+
if (t !== null) for (const e of Reflect.ownKeys(t)) if (t[e].l & CONFIG_OVERRIDE) return true;
|
|
414
449
|
return false;
|
|
415
450
|
}
|
|
416
451
|
|
|
@@ -428,9 +463,9 @@ function overlaid(e) {
|
|
|
428
463
|
* the backing answers. */ function optimisticHas(e, n) {
|
|
429
464
|
if (!overlaid(e)) return undefined;
|
|
430
465
|
const t = e.h?.[n];
|
|
431
|
-
if (t !== undefined && t.
|
|
466
|
+
if (t !== undefined && t.l & CONFIG_OVERRIDE) return !!shown(t);
|
|
432
467
|
const i = e.n?.[n];
|
|
433
|
-
if (i !== undefined && i.
|
|
468
|
+
if (i !== undefined && i.l & CONFIG_OVERRIDE) return shown(i) !== undefined;
|
|
434
469
|
return undefined;
|
|
435
470
|
}
|
|
436
471
|
|
|
@@ -441,7 +476,7 @@ function overlaid(e) {
|
|
|
441
476
|
if (t === undefined) return undefined;
|
|
442
477
|
if (!t) return null;
|
|
443
478
|
const i = e.n?.[n];
|
|
444
|
-
const r = i !== undefined && i.
|
|
479
|
+
const r = i !== undefined && i.l & CONFIG_OVERRIDE ? shown(i) : e.v[n];
|
|
445
480
|
// An array's `length` is reported as the array has it (non-configurable).
|
|
446
481
|
if (n === "length" && Array.isArray(e.v)) return {
|
|
447
482
|
value: r,
|
|
@@ -474,7 +509,7 @@ i = false) {
|
|
|
474
509
|
for (const e of Reflect.ownKeys(o)) {
|
|
475
510
|
const r = o[e];
|
|
476
511
|
let s;
|
|
477
|
-
if (r.
|
|
512
|
+
if (r.l & CONFIG_OVERRIDE) s = t(r); else if (!i || (s = pendingGuessOf(r)) === NOT_PENDING) continue;
|
|
478
513
|
if (e === "length" && Array.isArray(n)) {
|
|
479
514
|
if (n.length !== s) ensure().length = s;
|
|
480
515
|
} else if (!isEqual(n[e], s) || !hasOwn.call(n, e)) {
|
|
@@ -487,10 +522,10 @@ i = false) {
|
|
|
487
522
|
for (const e of Reflect.ownKeys(s)) {
|
|
488
523
|
const o = s[e];
|
|
489
524
|
let a;
|
|
490
|
-
if (o.
|
|
525
|
+
if (o.l & CONFIG_OVERRIDE) a = t(o); else if (!i || (a = pendingGuessOf(o)) === NOT_PENDING) continue;
|
|
491
526
|
const f = !!a;
|
|
492
|
-
const
|
|
493
|
-
if (!f && e in
|
|
527
|
+
const u = r ?? n;
|
|
528
|
+
if (!f && e in u) delete ensure()[e];
|
|
494
529
|
}
|
|
495
530
|
}
|
|
496
531
|
return r ?? n;
|
|
@@ -499,7 +534,9 @@ i = false) {
|
|
|
499
534
|
function createOptimisticStore(e, n, t) {
|
|
500
535
|
const i = typeof e === "function";
|
|
501
536
|
const r = i ? t : n;
|
|
502
|
-
|
|
537
|
+
// Seedless derived form: the root starts as an empty record (see
|
|
538
|
+
// createProjectionInternal).
|
|
539
|
+
const o = i ? n || {} : e;
|
|
503
540
|
const s = r?.key === undefined ? "id" : r.key;
|
|
504
541
|
const a = {
|
|
505
542
|
map: new WeakMap,
|
|
@@ -510,7 +547,7 @@ function createOptimisticStore(e, n, t) {
|
|
|
510
547
|
key: typeof s === "function" ? s : s === null ? null : e => isWrappable(e) ? e[s] : undefined
|
|
511
548
|
};
|
|
512
549
|
const f = wrap(o, null, null, a);
|
|
513
|
-
nameStore(f, r?.name);
|
|
550
|
+
nameStore(f, r?.name, r?.loc);
|
|
514
551
|
if (a.shallow) {
|
|
515
552
|
f[$TARGET].s = true;
|
|
516
553
|
markRawIngest(o);
|
|
@@ -521,15 +558,16 @@ function createOptimisticStore(e, n, t) {
|
|
|
521
558
|
if (r?.seedLoadingValue) t = {
|
|
522
559
|
loadingValue: undefined
|
|
523
560
|
};
|
|
524
|
-
if (r?.name) t = {
|
|
561
|
+
if (r?.name || r?.loc) t = {
|
|
525
562
|
...t,
|
|
526
|
-
name: r.name
|
|
563
|
+
name: r.name,
|
|
564
|
+
loc: r.loc
|
|
527
565
|
};
|
|
528
566
|
const i = computed(() => {
|
|
529
567
|
if (!a.node) a.node = getOwner();
|
|
530
568
|
runProjectionComputed(f, n, s);
|
|
531
569
|
}, t);
|
|
532
|
-
i.
|
|
570
|
+
i.l &= ~CONFIG_AUTO_DISPOSE;
|
|
533
571
|
a.node = i;
|
|
534
572
|
}
|
|
535
573
|
return [ f, e => storeSetter(f, e) ];
|