@solidjs/signals 0.11.3 → 0.12.0
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 +32 -20
- package/dist/node.cjs +332 -327
- package/dist/prod.js +13 -13
- package/dist/types/core/core.d.ts +9 -3
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -151,6 +151,10 @@ let clock = 0;
|
|
|
151
151
|
let activeTransition = null;
|
|
152
152
|
let scheduled = false;
|
|
153
153
|
let projectionWriteActive = false;
|
|
154
|
+
let _onUnhandledAsync = null;
|
|
155
|
+
function setOnUnhandledAsync(fn) {
|
|
156
|
+
_onUnhandledAsync = fn;
|
|
157
|
+
}
|
|
154
158
|
function runLaneEffects(type) {
|
|
155
159
|
for (const lane of activeLanes) {
|
|
156
160
|
if (lane._mergedInto || lane._pendingAsync.size > 0) continue;
|
|
@@ -167,7 +171,7 @@ function setProjectionWriteActive(value) {
|
|
|
167
171
|
function schedule() {
|
|
168
172
|
if (scheduled) return;
|
|
169
173
|
scheduled = true;
|
|
170
|
-
if (!globalQueue._running) queueMicrotask(flush);
|
|
174
|
+
if (!globalQueue._running && !projectionWriteActive) queueMicrotask(flush);
|
|
171
175
|
}
|
|
172
176
|
class Queue {
|
|
173
177
|
_parent = null;
|
|
@@ -287,6 +291,9 @@ class GlobalQueue extends Queue {
|
|
|
287
291
|
}
|
|
288
292
|
notify(node, mask, flags, error) {
|
|
289
293
|
if (mask & STATUS_PENDING) {
|
|
294
|
+
if (_onUnhandledAsync && flags & STATUS_PENDING) {
|
|
295
|
+
_onUnhandledAsync();
|
|
296
|
+
}
|
|
290
297
|
if (flags & STATUS_PENDING) {
|
|
291
298
|
const actualError = error !== undefined ? error : node._error;
|
|
292
299
|
if (
|
|
@@ -647,6 +654,10 @@ function handleAsync(el, result, setter) {
|
|
|
647
654
|
syncResult = r;
|
|
648
655
|
resolved = true;
|
|
649
656
|
} else if (!r.done) asyncWrite(r.value, iterate);
|
|
657
|
+
else {
|
|
658
|
+
schedule();
|
|
659
|
+
flush();
|
|
660
|
+
}
|
|
650
661
|
},
|
|
651
662
|
e => {
|
|
652
663
|
if (!isSync) handleError(e);
|
|
@@ -1212,7 +1223,10 @@ function updateIfNecessary(el) {
|
|
|
1212
1223
|
}
|
|
1213
1224
|
}
|
|
1214
1225
|
}
|
|
1215
|
-
if (
|
|
1226
|
+
if (
|
|
1227
|
+
el._flags & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) ||
|
|
1228
|
+
(el._error && el._time < clock && !el._inFlight)
|
|
1229
|
+
) {
|
|
1216
1230
|
recompute(el);
|
|
1217
1231
|
}
|
|
1218
1232
|
el._flags = REACTIVE_NONE | (el._flags & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1319,23 +1333,17 @@ function setStrictRead(v) {
|
|
|
1319
1333
|
strictRead = v;
|
|
1320
1334
|
return prev;
|
|
1321
1335
|
}
|
|
1322
|
-
function untrack(fn) {
|
|
1323
|
-
if (!tracking && !strictRead) return fn();
|
|
1336
|
+
function untrack(fn, strictReadLabel) {
|
|
1337
|
+
if (!tracking && !strictRead && !strictReadLabel) return fn();
|
|
1338
|
+
const prevTracking = tracking;
|
|
1339
|
+
const prevStrictRead = strictRead;
|
|
1324
1340
|
tracking = false;
|
|
1325
|
-
|
|
1326
|
-
const prev = strictRead;
|
|
1327
|
-
strictRead = false;
|
|
1328
|
-
try {
|
|
1329
|
-
return fn();
|
|
1330
|
-
} finally {
|
|
1331
|
-
tracking = true;
|
|
1332
|
-
strictRead = prev;
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1341
|
+
strictRead = strictReadLabel || false;
|
|
1335
1342
|
try {
|
|
1336
1343
|
return fn();
|
|
1337
1344
|
} finally {
|
|
1338
|
-
tracking =
|
|
1345
|
+
tracking = prevTracking;
|
|
1346
|
+
strictRead = prevStrictRead;
|
|
1339
1347
|
}
|
|
1340
1348
|
}
|
|
1341
1349
|
function read(el) {
|
|
@@ -1435,13 +1443,17 @@ function read(el) {
|
|
|
1435
1443
|
return snapshot;
|
|
1436
1444
|
}
|
|
1437
1445
|
}
|
|
1438
|
-
if (strictRead
|
|
1446
|
+
if (strictRead)
|
|
1439
1447
|
console.warn(
|
|
1440
1448
|
`Reactive value read at the top level of ${strictRead} will not update. ` +
|
|
1441
1449
|
`Move it into a tracking scope (JSX, computations, effects).`
|
|
1442
1450
|
);
|
|
1443
1451
|
return !c ||
|
|
1444
|
-
currentOptimisticLane !== null
|
|
1452
|
+
(currentOptimisticLane !== null &&
|
|
1453
|
+
(el._optimistic ||
|
|
1454
|
+
el._optimisticLane ||
|
|
1455
|
+
owner === el ||
|
|
1456
|
+
!!(owner._statusFlags & STATUS_PENDING))) ||
|
|
1445
1457
|
el._pendingValue === NOT_PENDING ||
|
|
1446
1458
|
(stale && el._transition && activeTransition !== el._transition)
|
|
1447
1459
|
? el._value
|
|
@@ -1940,7 +1952,6 @@ function createProjectionInternal(fn, initialValue = {}, options) {
|
|
|
1940
1952
|
value !== s &&
|
|
1941
1953
|
value !== undefined &&
|
|
1942
1954
|
storeSetter(wrappedStore, reconcile(value, options?.key || "id", options?.all));
|
|
1943
|
-
setSignal(owner, undefined);
|
|
1944
1955
|
});
|
|
1945
1956
|
value !== s &&
|
|
1946
1957
|
value !== undefined &&
|
|
@@ -2156,7 +2167,7 @@ const storeTraps = {
|
|
|
2156
2167
|
);
|
|
2157
2168
|
}
|
|
2158
2169
|
}
|
|
2159
|
-
if (strictRead &&
|
|
2170
|
+
if (strictRead && typeof property === "string")
|
|
2160
2171
|
console.warn(
|
|
2161
2172
|
`Reactive value read at the top level of ${strictRead} will not update. ` +
|
|
2162
2173
|
`Move it into a tracking scope (JSX, computations, effects).`
|
|
@@ -3105,6 +3116,7 @@ function flattenArray(children, results = [], options) {
|
|
|
3105
3116
|
}
|
|
3106
3117
|
export {
|
|
3107
3118
|
$PROXY,
|
|
3119
|
+
$REFRESH,
|
|
3108
3120
|
$TARGET,
|
|
3109
3121
|
$TRACK,
|
|
3110
3122
|
ContextNotFoundError,
|
|
@@ -3155,8 +3167,8 @@ export {
|
|
|
3155
3167
|
resolve,
|
|
3156
3168
|
runWithOwner,
|
|
3157
3169
|
setContext,
|
|
3170
|
+
setOnUnhandledAsync,
|
|
3158
3171
|
setSnapshotCapture,
|
|
3159
|
-
setStrictRead,
|
|
3160
3172
|
snapshot,
|
|
3161
3173
|
storePath,
|
|
3162
3174
|
untrack
|