@solidjs/signals 0.8.4 → 0.8.5
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 +14 -11
- package/dist/node.cjs +19 -15
- package/dist/prod.js +18 -15
- package/dist/types/core/core.d.ts +1 -2
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -248,8 +248,10 @@ class GlobalQueue extends Queue {
|
|
|
248
248
|
notify(node, mask, flags) {
|
|
249
249
|
if (mask & STATUS_PENDING) {
|
|
250
250
|
if (flags & STATUS_PENDING) {
|
|
251
|
-
if (activeTransition && !activeTransition.asyncNodes.includes(node._error.cause))
|
|
251
|
+
if (activeTransition && !activeTransition.asyncNodes.includes(node._error.cause)) {
|
|
252
252
|
activeTransition.asyncNodes.push(node._error.cause);
|
|
253
|
+
schedule();
|
|
254
|
+
}
|
|
253
255
|
}
|
|
254
256
|
return true;
|
|
255
257
|
}
|
|
@@ -380,18 +382,20 @@ function recompute(el, create = false) {
|
|
|
380
382
|
if (depsTail !== null) depsTail._nextDep = null;
|
|
381
383
|
else el._deps = null;
|
|
382
384
|
}
|
|
385
|
+
const honoraryOptimistic = el._type && el._transition != activeTransition;
|
|
383
386
|
const valueChanged =
|
|
384
387
|
!el._equals ||
|
|
385
388
|
!el._equals(
|
|
386
|
-
el._pendingValue === NOT_PENDING || el._optimistic
|
|
389
|
+
el._pendingValue === NOT_PENDING || el._optimistic || honoraryOptimistic
|
|
390
|
+
? el._value
|
|
391
|
+
: el._pendingValue,
|
|
387
392
|
value
|
|
388
393
|
);
|
|
389
394
|
const statusFlagsChanged = el._statusFlags !== prevStatusFlags || el._error !== prevError;
|
|
390
395
|
el._notifyQueue?.(statusFlagsChanged, prevStatusFlags);
|
|
391
396
|
if (valueChanged || statusFlagsChanged) {
|
|
392
397
|
if (valueChanged) {
|
|
393
|
-
if (create || el._optimistic ||
|
|
394
|
-
el._value = value;
|
|
398
|
+
if (create || el._optimistic || honoraryOptimistic) el._value = value;
|
|
395
399
|
else {
|
|
396
400
|
if (el._pendingValue === NOT_PENDING) globalQueue._pendingNodes.push(el);
|
|
397
401
|
el._pendingValue = value;
|
|
@@ -408,8 +412,7 @@ function recompute(el, create = false) {
|
|
|
408
412
|
insertIntoHeapHeight(s._sub, s._sub._flags & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
|
-
if (el.
|
|
412
|
-
runInTransition(el, recompute);
|
|
415
|
+
if (el._transition && honoraryOptimistic) runInTransition(el, recompute);
|
|
413
416
|
}
|
|
414
417
|
function updateIfNecessary(el) {
|
|
415
418
|
if (el._flags & REACTIVE_CHECK) {
|
|
@@ -593,7 +596,8 @@ function computed(fn, initialValue, options) {
|
|
|
593
596
|
_time: clock,
|
|
594
597
|
_pendingValue: NOT_PENDING,
|
|
595
598
|
_pendingDisposal: null,
|
|
596
|
-
_pendingFirstChild: null
|
|
599
|
+
_pendingFirstChild: null,
|
|
600
|
+
_transition: null
|
|
597
601
|
};
|
|
598
602
|
if (options?._internal) Object.assign(self, options._internal);
|
|
599
603
|
self._name = options?.name ?? "computed";
|
|
@@ -747,9 +751,9 @@ function read(el) {
|
|
|
747
751
|
pendingValueCheck = true;
|
|
748
752
|
}
|
|
749
753
|
}
|
|
750
|
-
if (el._statusFlags & STATUS_PENDING) {
|
|
754
|
+
if (el._statusFlags & STATUS_PENDING && !pendingCheck) {
|
|
751
755
|
if ((c && !stale) || el._statusFlags & STATUS_UNINITIALIZED) throw el._error;
|
|
752
|
-
else if (c && stale
|
|
756
|
+
else if (c && stale) {
|
|
753
757
|
setStatusFlags(c, c._statusFlags | 1, el._error);
|
|
754
758
|
}
|
|
755
759
|
}
|
|
@@ -874,7 +878,7 @@ function pending(fn) {
|
|
|
874
878
|
pendingValueCheck = prevLatest;
|
|
875
879
|
}
|
|
876
880
|
}
|
|
877
|
-
function isPending(fn
|
|
881
|
+
function isPending(fn) {
|
|
878
882
|
const current = pendingCheck;
|
|
879
883
|
pendingCheck = { _value: false };
|
|
880
884
|
try {
|
|
@@ -882,7 +886,6 @@ function isPending(fn, loadingValue) {
|
|
|
882
886
|
return pendingCheck._value;
|
|
883
887
|
} catch (err) {
|
|
884
888
|
if (!(err instanceof NotReadyError)) return false;
|
|
885
|
-
if (loadingValue !== undefined) return loadingValue;
|
|
886
889
|
throw err;
|
|
887
890
|
} finally {
|
|
888
891
|
pendingCheck = current;
|
package/dist/node.cjs
CHANGED
|
@@ -246,7 +246,10 @@ class GlobalQueue extends Queue {
|
|
|
246
246
|
notify(e, t, n) {
|
|
247
247
|
if (t & f) {
|
|
248
248
|
if (n & f) {
|
|
249
|
-
if (m && !m.asyncNodes.includes(e.L.cause))
|
|
249
|
+
if (m && !m.asyncNodes.includes(e.L.cause)) {
|
|
250
|
+
m.asyncNodes.push(e.L.cause);
|
|
251
|
+
schedule();
|
|
252
|
+
}
|
|
250
253
|
}
|
|
251
254
|
return true;
|
|
252
255
|
}
|
|
@@ -369,12 +372,13 @@ function recompute(t, n = false) {
|
|
|
369
372
|
if (g !== null) g.P = null;
|
|
370
373
|
else t.W = null;
|
|
371
374
|
}
|
|
372
|
-
const x =
|
|
373
|
-
const v = t
|
|
374
|
-
t.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
const x = t.T && t.J != m;
|
|
376
|
+
const v = !t.oe || !t.oe(t.K === p || t.ue || x ? t.G : t.K, s);
|
|
377
|
+
const N = t.$ !== d || t.L !== h;
|
|
378
|
+
t.le?.(N, d);
|
|
379
|
+
if (v || N) {
|
|
380
|
+
if (v) {
|
|
381
|
+
if (n || t.ue || x) t.G = s;
|
|
378
382
|
else {
|
|
379
383
|
if (t.K === p) O.M.push(t);
|
|
380
384
|
t.K = s;
|
|
@@ -391,7 +395,7 @@ function recompute(t, n = false) {
|
|
|
391
395
|
insertIntoHeapHeight(e.N, e.N.S & o ? S : _);
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
|
-
if (t.
|
|
398
|
+
if (t.J && x) runInTransition(t, recompute);
|
|
395
399
|
}
|
|
396
400
|
function updateIfNecessary(r) {
|
|
397
401
|
if (r.S & t) {
|
|
@@ -571,7 +575,8 @@ function computed(t, n, r) {
|
|
|
571
575
|
se: b,
|
|
572
576
|
K: p,
|
|
573
577
|
te: null,
|
|
574
|
-
ee: null
|
|
578
|
+
ee: null,
|
|
579
|
+
J: null
|
|
575
580
|
};
|
|
576
581
|
if (r?.we) Object.assign(i, r.we);
|
|
577
582
|
i.h = i;
|
|
@@ -721,9 +726,9 @@ function read(e) {
|
|
|
721
726
|
N = true;
|
|
722
727
|
}
|
|
723
728
|
}
|
|
724
|
-
if (e.$ & f) {
|
|
729
|
+
if (e.$ & f && !k) {
|
|
725
730
|
if ((t && !v) || e.$ & a) throw e.L;
|
|
726
|
-
else if (t && v
|
|
731
|
+
else if (t && v) {
|
|
727
732
|
setStatusFlags(t, t.$ | 1, e.L);
|
|
728
733
|
}
|
|
729
734
|
}
|
|
@@ -836,18 +841,17 @@ function pending(e) {
|
|
|
836
841
|
N = t;
|
|
837
842
|
}
|
|
838
843
|
}
|
|
839
|
-
function isPending(e
|
|
840
|
-
const
|
|
844
|
+
function isPending(e) {
|
|
845
|
+
const t = k;
|
|
841
846
|
k = { G: false };
|
|
842
847
|
try {
|
|
843
848
|
staleValues(e);
|
|
844
849
|
return k.G;
|
|
845
850
|
} catch (e) {
|
|
846
851
|
if (!(e instanceof NotReadyError)) return false;
|
|
847
|
-
if (t !== undefined) return t;
|
|
848
852
|
throw e;
|
|
849
853
|
} finally {
|
|
850
|
-
k =
|
|
854
|
+
k = t;
|
|
851
855
|
}
|
|
852
856
|
}
|
|
853
857
|
function createContext(e, t) {
|
package/dist/prod.js
CHANGED
|
@@ -245,8 +245,10 @@ class GlobalQueue extends Queue {
|
|
|
245
245
|
notify(e, t, n) {
|
|
246
246
|
if (t & STATUS_PENDING) {
|
|
247
247
|
if (n & STATUS_PENDING) {
|
|
248
|
-
if (activeTransition && !activeTransition.asyncNodes.includes(e.Y.cause))
|
|
248
|
+
if (activeTransition && !activeTransition.asyncNodes.includes(e.Y.cause)) {
|
|
249
249
|
activeTransition.asyncNodes.push(e.Y.cause);
|
|
250
|
+
schedule();
|
|
251
|
+
}
|
|
250
252
|
}
|
|
251
253
|
return true;
|
|
252
254
|
}
|
|
@@ -374,12 +376,13 @@ function recompute(e, t = false) {
|
|
|
374
376
|
if (l !== null) l.P = null;
|
|
375
377
|
else e.D = null;
|
|
376
378
|
}
|
|
377
|
-
const a =
|
|
378
|
-
const f = e.
|
|
379
|
-
e.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
379
|
+
const a = e.K && e.B != activeTransition;
|
|
380
|
+
const f = !e.oe || !e.oe(e.W === NOT_PENDING || e.ue || a ? e.j : e.W, i);
|
|
381
|
+
const E = e.J !== s || e.Y !== o;
|
|
382
|
+
e.le?.(E, s);
|
|
383
|
+
if (f || E) {
|
|
384
|
+
if (f) {
|
|
385
|
+
if (t || e.ue || a) e.j = i;
|
|
383
386
|
else {
|
|
384
387
|
if (e.W === NOT_PENDING) globalQueue.$.push(e);
|
|
385
388
|
e.W = i;
|
|
@@ -396,7 +399,7 @@ function recompute(e, t = false) {
|
|
|
396
399
|
insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
397
400
|
}
|
|
398
401
|
}
|
|
399
|
-
if (e.
|
|
402
|
+
if (e.B && a) runInTransition(e, recompute);
|
|
400
403
|
}
|
|
401
404
|
function updateIfNecessary(e) {
|
|
402
405
|
if (e._ & REACTIVE_CHECK) {
|
|
@@ -576,7 +579,8 @@ function computed(e, t, n) {
|
|
|
576
579
|
se: clock,
|
|
577
580
|
W: NOT_PENDING,
|
|
578
581
|
te: null,
|
|
579
|
-
ee: null
|
|
582
|
+
ee: null,
|
|
583
|
+
B: null
|
|
580
584
|
};
|
|
581
585
|
if (n?._e) Object.assign(i, n._e);
|
|
582
586
|
i.T = i;
|
|
@@ -726,9 +730,9 @@ function read(e) {
|
|
|
726
730
|
pendingValueCheck = true;
|
|
727
731
|
}
|
|
728
732
|
}
|
|
729
|
-
if (e.J & STATUS_PENDING) {
|
|
733
|
+
if (e.J & STATUS_PENDING && !pendingCheck) {
|
|
730
734
|
if ((t && !stale) || e.J & STATUS_UNINITIALIZED) throw e.Y;
|
|
731
|
-
else if (t && stale
|
|
735
|
+
else if (t && stale) {
|
|
732
736
|
setStatusFlags(t, t.J | 1, e.Y);
|
|
733
737
|
}
|
|
734
738
|
}
|
|
@@ -846,18 +850,17 @@ function pending(e) {
|
|
|
846
850
|
pendingValueCheck = t;
|
|
847
851
|
}
|
|
848
852
|
}
|
|
849
|
-
function isPending(e
|
|
850
|
-
const
|
|
853
|
+
function isPending(e) {
|
|
854
|
+
const t = pendingCheck;
|
|
851
855
|
pendingCheck = { j: false };
|
|
852
856
|
try {
|
|
853
857
|
staleValues(e);
|
|
854
858
|
return pendingCheck.j;
|
|
855
859
|
} catch (e) {
|
|
856
860
|
if (!(e instanceof NotReadyError)) return false;
|
|
857
|
-
if (t !== undefined) return t;
|
|
858
861
|
throw e;
|
|
859
862
|
} finally {
|
|
860
|
-
pendingCheck =
|
|
863
|
+
pendingCheck = t;
|
|
861
864
|
}
|
|
862
865
|
}
|
|
863
866
|
function createContext(e, t) {
|
|
@@ -29,6 +29,7 @@ export interface RawSignal<T> {
|
|
|
29
29
|
_pureWrite?: boolean;
|
|
30
30
|
_unobserved?: () => void;
|
|
31
31
|
_time: number;
|
|
32
|
+
_transition: Transition | null;
|
|
32
33
|
_pendingValue: T | typeof NOT_PENDING;
|
|
33
34
|
_pendingCheck?: Signal<boolean> & {
|
|
34
35
|
_set: (v: boolean) => void;
|
|
@@ -36,7 +37,6 @@ export interface RawSignal<T> {
|
|
|
36
37
|
_pendingSignal?: Signal<T> & {
|
|
37
38
|
_set: (v: T) => void;
|
|
38
39
|
};
|
|
39
|
-
_transition?: Transition;
|
|
40
40
|
_optimistic?: boolean;
|
|
41
41
|
}
|
|
42
42
|
export interface FirewallSignal<T> extends RawSignal<T> {
|
|
@@ -121,4 +121,3 @@ export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
|
121
121
|
export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
122
122
|
export declare function pending<T>(fn: () => T): T;
|
|
123
123
|
export declare function isPending(fn: () => any): boolean;
|
|
124
|
-
export declare function isPending(fn: () => any, loadingValue: boolean): boolean;
|