@solidjs/signals 0.10.0 → 0.10.1
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 +22 -20
- package/dist/node.cjs +516 -513
- package/dist/prod.js +535 -532
- package/dist/types/core/error.d.ts +4 -4
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
class NotReadyError extends Error {
|
|
2
|
-
|
|
3
|
-
constructor(
|
|
2
|
+
source;
|
|
3
|
+
constructor(source) {
|
|
4
4
|
super();
|
|
5
|
-
this.
|
|
5
|
+
this.source = source;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
class StatusError extends Error {
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
9
|
+
source;
|
|
10
|
+
constructor(source, original) {
|
|
11
11
|
super(original instanceof Error ? original.message : String(original), { cause: original });
|
|
12
|
-
this.
|
|
12
|
+
this.source = source;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
class NoOwnerError extends Error {
|
|
@@ -288,9 +288,9 @@ class GlobalQueue extends Queue {
|
|
|
288
288
|
if (
|
|
289
289
|
activeTransition &&
|
|
290
290
|
actualError &&
|
|
291
|
-
!activeTransition._asyncNodes.includes(actualError.
|
|
291
|
+
!activeTransition._asyncNodes.includes(actualError.source)
|
|
292
292
|
) {
|
|
293
|
-
activeTransition._asyncNodes.push(actualError.
|
|
293
|
+
activeTransition._asyncNodes.push(actualError.source);
|
|
294
294
|
schedule();
|
|
295
295
|
}
|
|
296
296
|
}
|
|
@@ -463,7 +463,7 @@ function transitionComplete(transition) {
|
|
|
463
463
|
let done = true;
|
|
464
464
|
for (let i = 0; i < transition._asyncNodes.length; i++) {
|
|
465
465
|
const node = transition._asyncNodes[i];
|
|
466
|
-
if (node._statusFlags & STATUS_PENDING && node._error?.
|
|
466
|
+
if (node._statusFlags & STATUS_PENDING && node._error?.source === node) {
|
|
467
467
|
done = false;
|
|
468
468
|
break;
|
|
469
469
|
}
|
|
@@ -672,7 +672,7 @@ function notifyStatus(el, status, error, blockStatus, lane) {
|
|
|
672
672
|
!(error instanceof NotReadyError)
|
|
673
673
|
)
|
|
674
674
|
error = new StatusError(el, error);
|
|
675
|
-
const isSource = error instanceof NotReadyError && error.
|
|
675
|
+
const isSource = error instanceof NotReadyError && error.source === el;
|
|
676
676
|
const isOptimisticBoundary = status === STATUS_PENDING && el._optimistic && !isSource;
|
|
677
677
|
const startsBlocking = isOptimisticBoundary && hasActiveOverride(el);
|
|
678
678
|
if (!blockStatus) {
|
|
@@ -685,7 +685,7 @@ function notifyStatus(el, status, error, blockStatus, lane) {
|
|
|
685
685
|
assignOrMergeLane(el, lane);
|
|
686
686
|
}
|
|
687
687
|
if (startsBlocking && activeTransition && error instanceof NotReadyError) {
|
|
688
|
-
const source = error.
|
|
688
|
+
const source = error.source;
|
|
689
689
|
if (!activeTransition._asyncNodes.includes(source)) {
|
|
690
690
|
activeTransition._asyncNodes.push(source);
|
|
691
691
|
}
|
|
@@ -1623,7 +1623,8 @@ function onSettled(callback) {
|
|
|
1623
1623
|
function unwrap(value) {
|
|
1624
1624
|
return value?.[$TARGET]?.[STORE_NODE] ?? value;
|
|
1625
1625
|
}
|
|
1626
|
-
function getOverrideValue(value, override, nodes, key) {
|
|
1626
|
+
function getOverrideValue(value, override, nodes, key, optOverride) {
|
|
1627
|
+
if (optOverride && key in optOverride) return optOverride[key];
|
|
1627
1628
|
return override && key in override ? override[key] : value[key];
|
|
1628
1629
|
}
|
|
1629
1630
|
function getAllKeys(value, override, next) {
|
|
@@ -1636,20 +1637,21 @@ function applyState(next, state, keyFn, all) {
|
|
|
1636
1637
|
if (!target) return;
|
|
1637
1638
|
const previous = target[STORE_VALUE];
|
|
1638
1639
|
const override = target[STORE_OVERRIDE];
|
|
1640
|
+
const optOverride = target[STORE_OPTIMISTIC_OVERRIDE];
|
|
1639
1641
|
let nodes = target[STORE_NODE];
|
|
1640
|
-
if (next === previous && !override) return;
|
|
1642
|
+
if (next === previous && !override && !optOverride) return;
|
|
1641
1643
|
(target[STORE_LOOKUP] || storeLookup).set(next, target[$PROXY]);
|
|
1642
1644
|
target[STORE_VALUE] = next;
|
|
1643
1645
|
target[STORE_OVERRIDE] = undefined;
|
|
1644
1646
|
if (Array.isArray(previous)) {
|
|
1645
1647
|
let changed = false;
|
|
1646
|
-
const prevLength = getOverrideValue(previous, override, nodes, "length");
|
|
1648
|
+
const prevLength = getOverrideValue(previous, override, nodes, "length", optOverride);
|
|
1647
1649
|
if (next.length && prevLength && next[0] && keyFn(next[0]) != null) {
|
|
1648
1650
|
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
1649
1651
|
for (
|
|
1650
1652
|
start = 0, end = Math.min(prevLength, next.length);
|
|
1651
1653
|
start < end &&
|
|
1652
|
-
((item = getOverrideValue(previous, override, nodes, start)) === next[start] ||
|
|
1654
|
+
((item = getOverrideValue(previous, override, nodes, start, optOverride)) === next[start] ||
|
|
1653
1655
|
(item && next[start] && keyFn(item) === keyFn(next[start])));
|
|
1654
1656
|
start++
|
|
1655
1657
|
) {
|
|
@@ -1661,7 +1663,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1661
1663
|
end = prevLength - 1, newEnd = next.length - 1;
|
|
1662
1664
|
end >= start &&
|
|
1663
1665
|
newEnd >= start &&
|
|
1664
|
-
((item = getOverrideValue(previous, override, nodes, end)) === next[newEnd] ||
|
|
1666
|
+
((item = getOverrideValue(previous, override, nodes, end, optOverride)) === next[newEnd] ||
|
|
1665
1667
|
(item && next[newEnd] && keyFn(item) === keyFn(next[newEnd])));
|
|
1666
1668
|
end--, newEnd--
|
|
1667
1669
|
) {
|
|
@@ -1693,7 +1695,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1693
1695
|
newIndices.set(keyVal, j);
|
|
1694
1696
|
}
|
|
1695
1697
|
for (i = start; i <= end; i++) {
|
|
1696
|
-
item = getOverrideValue(previous, override, nodes, i);
|
|
1698
|
+
item = getOverrideValue(previous, override, nodes, i, optOverride);
|
|
1697
1699
|
keyVal = item ? keyFn(item) : item;
|
|
1698
1700
|
j = newIndices.get(keyVal);
|
|
1699
1701
|
if (j !== undefined && j !== -1) {
|
|
@@ -1712,7 +1714,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1712
1714
|
if (start < next.length) changed = true;
|
|
1713
1715
|
} else if (next.length) {
|
|
1714
1716
|
for (let i = 0, len = next.length; i < len; i++) {
|
|
1715
|
-
const item = getOverrideValue(previous, override, nodes, i);
|
|
1717
|
+
const item = getOverrideValue(previous, override, nodes, i, optOverride);
|
|
1716
1718
|
isWrappable(item)
|
|
1717
1719
|
? applyState(next[i], wrap(item, target), keyFn, all)
|
|
1718
1720
|
: target[STORE_NODE][i] && setSignal(target[STORE_NODE][i], next[i]);
|
|
@@ -1731,7 +1733,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1731
1733
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
1732
1734
|
const key = keys[i];
|
|
1733
1735
|
const node = nodes[key];
|
|
1734
|
-
const previousValue = unwrap(getOverrideValue(previous, override, nodes, key));
|
|
1736
|
+
const previousValue = unwrap(getOverrideValue(previous, override, nodes, key, optOverride));
|
|
1735
1737
|
let nextValue = unwrap(next[key]);
|
|
1736
1738
|
if (previousValue === nextValue) continue;
|
|
1737
1739
|
if (
|
|
@@ -2746,7 +2748,7 @@ class CollectionQueue extends Queue {
|
|
|
2746
2748
|
)
|
|
2747
2749
|
return super.notify(node, type, flags, error);
|
|
2748
2750
|
if (flags & this._collectionType) {
|
|
2749
|
-
const source = error?.
|
|
2751
|
+
const source = error?.source || node._error?.source;
|
|
2750
2752
|
if (source) {
|
|
2751
2753
|
const wasEmpty = this._sources.size === 0;
|
|
2752
2754
|
this._sources.add(source);
|