@solidjs/signals 0.13.5 → 0.13.6
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 +42 -21
- package/dist/node.cjs +187 -177
- package/dist/prod.js +291 -281
- package/dist/types/core/scheduler.d.ts +5 -5
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -151,6 +151,7 @@ let clock = 0;
|
|
|
151
151
|
let activeTransition = null;
|
|
152
152
|
let scheduled = false;
|
|
153
153
|
let projectionWriteActive = false;
|
|
154
|
+
let inTrackedQueueCallback = false;
|
|
154
155
|
let _enforceLoadingBoundary = false;
|
|
155
156
|
let _hitUnhandledAsync = false;
|
|
156
157
|
let stashedOptimisticReads = null;
|
|
@@ -192,6 +193,9 @@ function queueStashedOptimisticEffects(node) {
|
|
|
192
193
|
function setProjectionWriteActive(value) {
|
|
193
194
|
projectionWriteActive = value;
|
|
194
195
|
}
|
|
196
|
+
function setTrackedQueueCallback(value) {
|
|
197
|
+
inTrackedQueueCallback = value;
|
|
198
|
+
}
|
|
195
199
|
function mergeTransitionState(target, outgoing) {
|
|
196
200
|
outgoing._done = target;
|
|
197
201
|
target._actions.push(...outgoing._actions);
|
|
@@ -242,20 +246,6 @@ function schedule() {
|
|
|
242
246
|
scheduled = true;
|
|
243
247
|
if (!globalQueue._running && !projectionWriteActive) queueMicrotask(flush);
|
|
244
248
|
}
|
|
245
|
-
function addTransitionBlocker(node) {
|
|
246
|
-
if (activeTransition && !activeTransition._asyncNodes.includes(node)) {
|
|
247
|
-
activeTransition._asyncNodes.push(node);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function removeTransitionBlocker(node) {
|
|
251
|
-
const remove = list => {
|
|
252
|
-
if (!list) return;
|
|
253
|
-
const index = list.indexOf(node);
|
|
254
|
-
if (index >= 0) list.splice(index, 1);
|
|
255
|
-
};
|
|
256
|
-
remove(node._transition?._asyncNodes);
|
|
257
|
-
remove(activeTransition?._asyncNodes);
|
|
258
|
-
}
|
|
259
249
|
class Queue {
|
|
260
250
|
_parent = null;
|
|
261
251
|
_queues = [[], []];
|
|
@@ -532,6 +522,14 @@ function reassignPendingTransition(pendingNodes) {
|
|
|
532
522
|
}
|
|
533
523
|
const globalQueue = new GlobalQueue();
|
|
534
524
|
function flush() {
|
|
525
|
+
if (globalQueue._running) {
|
|
526
|
+
if (inTrackedQueueCallback) {
|
|
527
|
+
throw new Error(
|
|
528
|
+
"Cannot call flush() from inside onSettled or createTrackedEffect. flush() is not reentrant there."
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
535
533
|
let count = 0;
|
|
536
534
|
while (scheduled || activeTransition) {
|
|
537
535
|
if (++count === 1e5) throw new Error("Potential Infinite Loop Detected.");
|
|
@@ -552,6 +550,21 @@ function transitionComplete(transition) {
|
|
|
552
550
|
break;
|
|
553
551
|
}
|
|
554
552
|
}
|
|
553
|
+
if (done) {
|
|
554
|
+
for (let i = 0; i < transition._optimisticNodes.length; i++) {
|
|
555
|
+
const node = transition._optimisticNodes[i];
|
|
556
|
+
if (
|
|
557
|
+
hasActiveOverride(node) &&
|
|
558
|
+
"_statusFlags" in node &&
|
|
559
|
+
node._statusFlags & STATUS_PENDING &&
|
|
560
|
+
node._error instanceof NotReadyError &&
|
|
561
|
+
node._error.source !== node
|
|
562
|
+
) {
|
|
563
|
+
done = false;
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
555
568
|
done && (transition._done = true);
|
|
556
569
|
return done;
|
|
557
570
|
}
|
|
@@ -843,7 +856,6 @@ function handleAsync(el, result, setter) {
|
|
|
843
856
|
}
|
|
844
857
|
function clearStatus(el, clearUninitialized = false) {
|
|
845
858
|
clearPendingSources(el);
|
|
846
|
-
removeTransitionBlocker(el);
|
|
847
859
|
el._blocked = false;
|
|
848
860
|
el._statusFlags = clearUninitialized ? 0 : el._statusFlags & STATUS_UNINITIALIZED;
|
|
849
861
|
setPendingError(el);
|
|
@@ -867,11 +879,9 @@ function notifyStatus(el, status, error, blockStatus, lane) {
|
|
|
867
879
|
if (status === STATUS_PENDING && pendingSource) {
|
|
868
880
|
addPendingSource(el, pendingSource);
|
|
869
881
|
el._statusFlags = STATUS_PENDING | (el._statusFlags & STATUS_UNINITIALIZED);
|
|
870
|
-
setPendingError(el,
|
|
871
|
-
if (pendingSource === el) addTransitionBlocker(el);
|
|
882
|
+
setPendingError(el, pendingSource, error);
|
|
872
883
|
} else {
|
|
873
884
|
clearPendingSources(el);
|
|
874
|
-
removeTransitionBlocker(el);
|
|
875
885
|
el._statusFlags =
|
|
876
886
|
status | (status !== STATUS_ERROR ? el._statusFlags & STATUS_UNINITIALIZED : 0);
|
|
877
887
|
el._error = error;
|
|
@@ -884,6 +894,9 @@ function notifyStatus(el, status, error, blockStatus, lane) {
|
|
|
884
894
|
const downstreamBlockStatus = blockStatus || startsBlocking;
|
|
885
895
|
const downstreamLane = blockStatus || isOptimisticBoundary ? undefined : lane;
|
|
886
896
|
if (el._notifyStatus) {
|
|
897
|
+
if (blockStatus && status === STATUS_PENDING) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
887
900
|
if (downstreamBlockStatus) {
|
|
888
901
|
el._notifyStatus(status, error);
|
|
889
902
|
} else {
|
|
@@ -901,7 +914,7 @@ function notifyStatus(el, status, error, blockStatus, lane) {
|
|
|
901
914
|
(status !== STATUS_PENDING &&
|
|
902
915
|
(sub._error !== error || sub._pendingSource || sub._pendingSources))
|
|
903
916
|
) {
|
|
904
|
-
!sub._transition
|
|
917
|
+
if (!downstreamBlockStatus && !sub._transition) globalQueue._pendingNodes.push(sub);
|
|
905
918
|
notifyStatus(sub, status, error, downstreamBlockStatus, downstreamLane);
|
|
906
919
|
}
|
|
907
920
|
});
|
|
@@ -1559,6 +1572,9 @@ function read(el) {
|
|
|
1559
1572
|
if (!tracking && el !== c) link(el, c);
|
|
1560
1573
|
throw owner._error;
|
|
1561
1574
|
}
|
|
1575
|
+
} else if (c && owner !== el && owner._statusFlags & STATUS_UNINITIALIZED) {
|
|
1576
|
+
if (!tracking && el !== c) link(el, c);
|
|
1577
|
+
throw owner._error;
|
|
1562
1578
|
} else if (!c && owner._statusFlags & STATUS_UNINITIALIZED) {
|
|
1563
1579
|
throw owner._error;
|
|
1564
1580
|
}
|
|
@@ -1888,8 +1904,13 @@ function runEffect() {
|
|
|
1888
1904
|
function trackedEffect(fn, options) {
|
|
1889
1905
|
const run = () => {
|
|
1890
1906
|
if (!node._modified || node._flags & REACTIVE_DISPOSED) return;
|
|
1891
|
-
|
|
1892
|
-
|
|
1907
|
+
setTrackedQueueCallback(true);
|
|
1908
|
+
try {
|
|
1909
|
+
node._modified = false;
|
|
1910
|
+
recompute(node);
|
|
1911
|
+
} finally {
|
|
1912
|
+
setTrackedQueueCallback(false);
|
|
1913
|
+
}
|
|
1893
1914
|
};
|
|
1894
1915
|
const node = computed(
|
|
1895
1916
|
() => {
|