@solidjs/signals 0.10.0 → 0.10.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 +24 -20
- package/dist/node.cjs +532 -527
- package/dist/prod.js +551 -546
- 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
|
}
|
|
@@ -858,6 +858,7 @@ function disposeChildren(node, self = false, zombie) {
|
|
|
858
858
|
} else {
|
|
859
859
|
node._firstChild = null;
|
|
860
860
|
node._nextSibling = null;
|
|
861
|
+
node._childCount = 0;
|
|
861
862
|
}
|
|
862
863
|
runDisposal(node, zombie);
|
|
863
864
|
}
|
|
@@ -1019,6 +1020,7 @@ function recompute(el, create = false) {
|
|
|
1019
1020
|
el._pendingFirstChild = el._firstChild;
|
|
1020
1021
|
el._disposal = null;
|
|
1021
1022
|
el._firstChild = null;
|
|
1023
|
+
el._childCount = 0;
|
|
1022
1024
|
}
|
|
1023
1025
|
}
|
|
1024
1026
|
const isOptimisticDirty = !!(el._flags & REACTIVE_OPTIMISTIC_DIRTY);
|
|
@@ -1623,7 +1625,8 @@ function onSettled(callback) {
|
|
|
1623
1625
|
function unwrap(value) {
|
|
1624
1626
|
return value?.[$TARGET]?.[STORE_NODE] ?? value;
|
|
1625
1627
|
}
|
|
1626
|
-
function getOverrideValue(value, override, nodes, key) {
|
|
1628
|
+
function getOverrideValue(value, override, nodes, key, optOverride) {
|
|
1629
|
+
if (optOverride && key in optOverride) return optOverride[key];
|
|
1627
1630
|
return override && key in override ? override[key] : value[key];
|
|
1628
1631
|
}
|
|
1629
1632
|
function getAllKeys(value, override, next) {
|
|
@@ -1636,20 +1639,21 @@ function applyState(next, state, keyFn, all) {
|
|
|
1636
1639
|
if (!target) return;
|
|
1637
1640
|
const previous = target[STORE_VALUE];
|
|
1638
1641
|
const override = target[STORE_OVERRIDE];
|
|
1642
|
+
const optOverride = target[STORE_OPTIMISTIC_OVERRIDE];
|
|
1639
1643
|
let nodes = target[STORE_NODE];
|
|
1640
|
-
if (next === previous && !override) return;
|
|
1644
|
+
if (next === previous && !override && !optOverride) return;
|
|
1641
1645
|
(target[STORE_LOOKUP] || storeLookup).set(next, target[$PROXY]);
|
|
1642
1646
|
target[STORE_VALUE] = next;
|
|
1643
1647
|
target[STORE_OVERRIDE] = undefined;
|
|
1644
1648
|
if (Array.isArray(previous)) {
|
|
1645
1649
|
let changed = false;
|
|
1646
|
-
const prevLength = getOverrideValue(previous, override, nodes, "length");
|
|
1650
|
+
const prevLength = getOverrideValue(previous, override, nodes, "length", optOverride);
|
|
1647
1651
|
if (next.length && prevLength && next[0] && keyFn(next[0]) != null) {
|
|
1648
1652
|
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
1649
1653
|
for (
|
|
1650
1654
|
start = 0, end = Math.min(prevLength, next.length);
|
|
1651
1655
|
start < end &&
|
|
1652
|
-
((item = getOverrideValue(previous, override, nodes, start)) === next[start] ||
|
|
1656
|
+
((item = getOverrideValue(previous, override, nodes, start, optOverride)) === next[start] ||
|
|
1653
1657
|
(item && next[start] && keyFn(item) === keyFn(next[start])));
|
|
1654
1658
|
start++
|
|
1655
1659
|
) {
|
|
@@ -1661,7 +1665,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1661
1665
|
end = prevLength - 1, newEnd = next.length - 1;
|
|
1662
1666
|
end >= start &&
|
|
1663
1667
|
newEnd >= start &&
|
|
1664
|
-
((item = getOverrideValue(previous, override, nodes, end)) === next[newEnd] ||
|
|
1668
|
+
((item = getOverrideValue(previous, override, nodes, end, optOverride)) === next[newEnd] ||
|
|
1665
1669
|
(item && next[newEnd] && keyFn(item) === keyFn(next[newEnd])));
|
|
1666
1670
|
end--, newEnd--
|
|
1667
1671
|
) {
|
|
@@ -1693,7 +1697,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1693
1697
|
newIndices.set(keyVal, j);
|
|
1694
1698
|
}
|
|
1695
1699
|
for (i = start; i <= end; i++) {
|
|
1696
|
-
item = getOverrideValue(previous, override, nodes, i);
|
|
1700
|
+
item = getOverrideValue(previous, override, nodes, i, optOverride);
|
|
1697
1701
|
keyVal = item ? keyFn(item) : item;
|
|
1698
1702
|
j = newIndices.get(keyVal);
|
|
1699
1703
|
if (j !== undefined && j !== -1) {
|
|
@@ -1712,7 +1716,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1712
1716
|
if (start < next.length) changed = true;
|
|
1713
1717
|
} else if (next.length) {
|
|
1714
1718
|
for (let i = 0, len = next.length; i < len; i++) {
|
|
1715
|
-
const item = getOverrideValue(previous, override, nodes, i);
|
|
1719
|
+
const item = getOverrideValue(previous, override, nodes, i, optOverride);
|
|
1716
1720
|
isWrappable(item)
|
|
1717
1721
|
? applyState(next[i], wrap(item, target), keyFn, all)
|
|
1718
1722
|
: target[STORE_NODE][i] && setSignal(target[STORE_NODE][i], next[i]);
|
|
@@ -1731,7 +1735,7 @@ function applyState(next, state, keyFn, all) {
|
|
|
1731
1735
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
1732
1736
|
const key = keys[i];
|
|
1733
1737
|
const node = nodes[key];
|
|
1734
|
-
const previousValue = unwrap(getOverrideValue(previous, override, nodes, key));
|
|
1738
|
+
const previousValue = unwrap(getOverrideValue(previous, override, nodes, key, optOverride));
|
|
1735
1739
|
let nextValue = unwrap(next[key]);
|
|
1736
1740
|
if (previousValue === nextValue) continue;
|
|
1737
1741
|
if (
|
|
@@ -2746,7 +2750,7 @@ class CollectionQueue extends Queue {
|
|
|
2746
2750
|
)
|
|
2747
2751
|
return super.notify(node, type, flags, error);
|
|
2748
2752
|
if (flags & this._collectionType) {
|
|
2749
|
-
const source = error?.
|
|
2753
|
+
const source = error?.source || node._error?.source;
|
|
2750
2754
|
if (source) {
|
|
2751
2755
|
const wasEmpty = this._sources.size === 0;
|
|
2752
2756
|
this._sources.add(source);
|