@solidjs/signals 0.11.2 → 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 +38 -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);
|
|
@@ -1112,6 +1123,11 @@ function recompute(el, create = false) {
|
|
|
1112
1123
|
let oldHeight = el._height;
|
|
1113
1124
|
let prevTracking = tracking;
|
|
1114
1125
|
let prevLane = currentOptimisticLane;
|
|
1126
|
+
let prevStrictRead = false;
|
|
1127
|
+
{
|
|
1128
|
+
prevStrictRead = strictRead;
|
|
1129
|
+
strictRead = false;
|
|
1130
|
+
}
|
|
1115
1131
|
tracking = true;
|
|
1116
1132
|
if (isOptimisticDirty) {
|
|
1117
1133
|
const lane = resolveLane(el);
|
|
@@ -1143,6 +1159,7 @@ function recompute(el, create = false) {
|
|
|
1143
1159
|
);
|
|
1144
1160
|
} finally {
|
|
1145
1161
|
tracking = prevTracking;
|
|
1162
|
+
strictRead = prevStrictRead;
|
|
1146
1163
|
el._flags = REACTIVE_NONE | (create ? el._flags & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1147
1164
|
context = oldcontext;
|
|
1148
1165
|
}
|
|
@@ -1206,7 +1223,10 @@ function updateIfNecessary(el) {
|
|
|
1206
1223
|
}
|
|
1207
1224
|
}
|
|
1208
1225
|
}
|
|
1209
|
-
if (
|
|
1226
|
+
if (
|
|
1227
|
+
el._flags & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) ||
|
|
1228
|
+
(el._error && el._time < clock && !el._inFlight)
|
|
1229
|
+
) {
|
|
1210
1230
|
recompute(el);
|
|
1211
1231
|
}
|
|
1212
1232
|
el._flags = REACTIVE_NONE | (el._flags & REACTIVE_SNAPSHOT_STALE);
|
|
@@ -1313,23 +1333,17 @@ function setStrictRead(v) {
|
|
|
1313
1333
|
strictRead = v;
|
|
1314
1334
|
return prev;
|
|
1315
1335
|
}
|
|
1316
|
-
function untrack(fn) {
|
|
1317
|
-
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;
|
|
1318
1340
|
tracking = false;
|
|
1319
|
-
|
|
1320
|
-
const prev = strictRead;
|
|
1321
|
-
strictRead = false;
|
|
1322
|
-
try {
|
|
1323
|
-
return fn();
|
|
1324
|
-
} finally {
|
|
1325
|
-
tracking = true;
|
|
1326
|
-
strictRead = prev;
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1341
|
+
strictRead = strictReadLabel || false;
|
|
1329
1342
|
try {
|
|
1330
1343
|
return fn();
|
|
1331
1344
|
} finally {
|
|
1332
|
-
tracking =
|
|
1345
|
+
tracking = prevTracking;
|
|
1346
|
+
strictRead = prevStrictRead;
|
|
1333
1347
|
}
|
|
1334
1348
|
}
|
|
1335
1349
|
function read(el) {
|
|
@@ -1429,13 +1443,17 @@ function read(el) {
|
|
|
1429
1443
|
return snapshot;
|
|
1430
1444
|
}
|
|
1431
1445
|
}
|
|
1432
|
-
if (strictRead
|
|
1446
|
+
if (strictRead)
|
|
1433
1447
|
console.warn(
|
|
1434
1448
|
`Reactive value read at the top level of ${strictRead} will not update. ` +
|
|
1435
1449
|
`Move it into a tracking scope (JSX, computations, effects).`
|
|
1436
1450
|
);
|
|
1437
1451
|
return !c ||
|
|
1438
|
-
currentOptimisticLane !== null
|
|
1452
|
+
(currentOptimisticLane !== null &&
|
|
1453
|
+
(el._optimistic ||
|
|
1454
|
+
el._optimisticLane ||
|
|
1455
|
+
owner === el ||
|
|
1456
|
+
!!(owner._statusFlags & STATUS_PENDING))) ||
|
|
1439
1457
|
el._pendingValue === NOT_PENDING ||
|
|
1440
1458
|
(stale && el._transition && activeTransition !== el._transition)
|
|
1441
1459
|
? el._value
|
|
@@ -1934,7 +1952,6 @@ function createProjectionInternal(fn, initialValue = {}, options) {
|
|
|
1934
1952
|
value !== s &&
|
|
1935
1953
|
value !== undefined &&
|
|
1936
1954
|
storeSetter(wrappedStore, reconcile(value, options?.key || "id", options?.all));
|
|
1937
|
-
setSignal(owner, undefined);
|
|
1938
1955
|
});
|
|
1939
1956
|
value !== s &&
|
|
1940
1957
|
value !== undefined &&
|
|
@@ -2150,7 +2167,7 @@ const storeTraps = {
|
|
|
2150
2167
|
);
|
|
2151
2168
|
}
|
|
2152
2169
|
}
|
|
2153
|
-
if (strictRead &&
|
|
2170
|
+
if (strictRead && typeof property === "string")
|
|
2154
2171
|
console.warn(
|
|
2155
2172
|
`Reactive value read at the top level of ${strictRead} will not update. ` +
|
|
2156
2173
|
`Move it into a tracking scope (JSX, computations, effects).`
|
|
@@ -3099,6 +3116,7 @@ function flattenArray(children, results = [], options) {
|
|
|
3099
3116
|
}
|
|
3100
3117
|
export {
|
|
3101
3118
|
$PROXY,
|
|
3119
|
+
$REFRESH,
|
|
3102
3120
|
$TARGET,
|
|
3103
3121
|
$TRACK,
|
|
3104
3122
|
ContextNotFoundError,
|
|
@@ -3149,8 +3167,8 @@ export {
|
|
|
3149
3167
|
resolve,
|
|
3150
3168
|
runWithOwner,
|
|
3151
3169
|
setContext,
|
|
3170
|
+
setOnUnhandledAsync,
|
|
3152
3171
|
setSnapshotCapture,
|
|
3153
|
-
setStrictRead,
|
|
3154
3172
|
snapshot,
|
|
3155
3173
|
storePath,
|
|
3156
3174
|
untrack
|