@but212/atom-effect 0.15.2 → 0.15.3
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/atom-effect.min.js +1 -1
- package/dist/atom-effect.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +57 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const ne = {
|
|
|
31
31
|
MAX_SIZE: 1e3,
|
|
32
32
|
/** Number of objects to pre-allocate for performance-critical paths */
|
|
33
33
|
WARMUP_SIZE: 100
|
|
34
|
-
},
|
|
34
|
+
}, R = {
|
|
35
35
|
/** Maximum effect executions per second to detect infinite loops (Legacy/Fallback) */
|
|
36
36
|
MAX_EXECUTIONS_PER_SECOND: 1e3,
|
|
37
37
|
/** Threshold for cleaning up old execution timestamps */
|
|
@@ -58,7 +58,7 @@ const ne = {
|
|
|
58
58
|
/** Enable infinite loop detection warnings */
|
|
59
59
|
WARN_INFINITE_LOOP: !0
|
|
60
60
|
}, A = 1073741823, E = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", re = Object.freeze([]);
|
|
61
|
-
class
|
|
61
|
+
class N extends Error {
|
|
62
62
|
/**
|
|
63
63
|
* Creates a new AtomError
|
|
64
64
|
* @param message - Error message describing what went wrong
|
|
@@ -69,7 +69,7 @@ class C extends Error {
|
|
|
69
69
|
super(e), this.name = "AtomError", this.cause = t, this.recoverable = s, this.timestamp = /* @__PURE__ */ new Date();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class D extends N {
|
|
73
73
|
/**
|
|
74
74
|
* Creates a new ComputedError
|
|
75
75
|
* @param message - Error message
|
|
@@ -79,7 +79,7 @@ class R extends C {
|
|
|
79
79
|
super(e, t, !0), this.name = "ComputedError";
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
class y extends
|
|
82
|
+
class y extends N {
|
|
83
83
|
/**
|
|
84
84
|
* Creates a new EffectError
|
|
85
85
|
* @param message - Error message
|
|
@@ -89,7 +89,7 @@ class y extends C {
|
|
|
89
89
|
super(e, t, !1), this.name = "EffectError";
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
class P extends
|
|
92
|
+
class P extends N {
|
|
93
93
|
/**
|
|
94
94
|
* Creates a new SchedulerError
|
|
95
95
|
* @param message - Error message
|
|
@@ -131,6 +131,10 @@ const l = {
|
|
|
131
131
|
* Error thrown when subscribing to a dependency fails.
|
|
132
132
|
*/
|
|
133
133
|
COMPUTED_DEPENDENCY_SUBSCRIPTION_FAILED: "Failed to subscribe to dependency",
|
|
134
|
+
/**
|
|
135
|
+
* Error thrown when accessing a disposed computed value.
|
|
136
|
+
*/
|
|
137
|
+
COMPUTED_DISPOSED: "Cannot access a disposed computed",
|
|
134
138
|
// ─────────────────────────────────────────────────────────────────
|
|
135
139
|
// Atom errors
|
|
136
140
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -199,7 +203,7 @@ let q = 0;
|
|
|
199
203
|
function K(i, e, t) {
|
|
200
204
|
if (i._visitedEpoch !== t) {
|
|
201
205
|
if (i._visitedEpoch = t, i === e)
|
|
202
|
-
throw new
|
|
206
|
+
throw new D("Indirect circular dependency detected");
|
|
203
207
|
if (ce(i)) {
|
|
204
208
|
const s = i.dependencies;
|
|
205
209
|
for (let n = 0; n < s.length; n++) {
|
|
@@ -223,7 +227,7 @@ const I = {
|
|
|
223
227
|
*/
|
|
224
228
|
checkCircular(i, e) {
|
|
225
229
|
if (i === e)
|
|
226
|
-
throw new
|
|
230
|
+
throw new D("Direct circular dependency detected");
|
|
227
231
|
this.enabled && (q++, K(i, e, q));
|
|
228
232
|
},
|
|
229
233
|
attachDebugInfo(i, e, t) {
|
|
@@ -267,7 +271,7 @@ class Z extends W {
|
|
|
267
271
|
);
|
|
268
272
|
if (e !== null && typeof e == "object" && "execute" in e)
|
|
269
273
|
return this._addSubscriber(this._objSubs, e, g.HAS_OBJ_SUBS);
|
|
270
|
-
throw new
|
|
274
|
+
throw new N(l.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
|
|
271
275
|
}
|
|
272
276
|
/**
|
|
273
277
|
* Gets the total number of active subscribers.
|
|
@@ -312,7 +316,7 @@ class Z extends W {
|
|
|
312
316
|
h(e, t);
|
|
313
317
|
} catch (_) {
|
|
314
318
|
console.error(
|
|
315
|
-
new
|
|
319
|
+
new N(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
|
|
316
320
|
);
|
|
317
321
|
}
|
|
318
322
|
}
|
|
@@ -326,7 +330,7 @@ class Z extends W {
|
|
|
326
330
|
h.execute();
|
|
327
331
|
} catch (_) {
|
|
328
332
|
console.error(
|
|
329
|
-
new
|
|
333
|
+
new N(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
|
|
330
334
|
);
|
|
331
335
|
}
|
|
332
336
|
}
|
|
@@ -397,8 +401,8 @@ class z {
|
|
|
397
401
|
E && e && (e.acquired = 0, e.released = 0, e.rejected.frozen = 0, e.rejected.tooLarge = 0, e.rejected.poolFull = 0);
|
|
398
402
|
}
|
|
399
403
|
}
|
|
400
|
-
const d = Object.freeze([]), O = Object.freeze([]), p = Object.freeze([]), x = new z(), U = new z(),
|
|
401
|
-
function
|
|
404
|
+
const d = Object.freeze([]), O = Object.freeze([]), p = Object.freeze([]), x = new z(), U = new z(), C = new z();
|
|
405
|
+
function T(i, e, t, s) {
|
|
402
406
|
if (e != null) {
|
|
403
407
|
if ((typeof e == "object" || typeof e == "function") && typeof e.addDependency == "function") {
|
|
404
408
|
e.addDependency(i);
|
|
@@ -458,7 +462,7 @@ function fe() {
|
|
|
458
462
|
}
|
|
459
463
|
class Ee {
|
|
460
464
|
constructor() {
|
|
461
|
-
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this._isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations =
|
|
465
|
+
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this._isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = R.MAX_FLUSH_ITERATIONS;
|
|
462
466
|
}
|
|
463
467
|
/**
|
|
464
468
|
* Returns the current operational phase of the scheduler.
|
|
@@ -532,7 +536,7 @@ class Ee {
|
|
|
532
536
|
const c = s[o];
|
|
533
537
|
c._nextEpoch !== t && (c._nextEpoch = t, n[r++] = c);
|
|
534
538
|
}
|
|
535
|
-
this._size = r, this.batchQueueSize = 0, s.length >
|
|
539
|
+
this._size = r, this.batchQueueSize = 0, s.length > R.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
|
|
536
540
|
}
|
|
537
541
|
_drainQueue() {
|
|
538
542
|
let e = 0;
|
|
@@ -578,9 +582,9 @@ class Ee {
|
|
|
578
582
|
this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this._isBatching = !1);
|
|
579
583
|
}
|
|
580
584
|
setMaxFlushIterations(e) {
|
|
581
|
-
if (e <
|
|
585
|
+
if (e < R.MIN_FLUSH_ITERATIONS)
|
|
582
586
|
throw new P(
|
|
583
|
-
`Max flush iterations must be at least ${
|
|
587
|
+
`Max flush iterations must be at least ${R.MIN_FLUSH_ITERATIONS}`
|
|
584
588
|
);
|
|
585
589
|
this.maxFlushIterations = e;
|
|
586
590
|
}
|
|
@@ -616,7 +620,7 @@ class de {
|
|
|
616
620
|
const f = new de();
|
|
617
621
|
function pe(i) {
|
|
618
622
|
if (typeof i != "function")
|
|
619
|
-
throw new
|
|
623
|
+
throw new N("Untracked callback must be a function");
|
|
620
624
|
const e = f.current;
|
|
621
625
|
f.current = null;
|
|
622
626
|
try {
|
|
@@ -634,7 +638,7 @@ class Se extends Z {
|
|
|
634
638
|
*/
|
|
635
639
|
get value() {
|
|
636
640
|
const e = f.current;
|
|
637
|
-
return e &&
|
|
641
|
+
return e && T(this, e, this._fnSubs, this._objSubs), this._value;
|
|
638
642
|
}
|
|
639
643
|
/**
|
|
640
644
|
* Sets a new value and schedules notifications if the value has changed.
|
|
@@ -689,7 +693,7 @@ function m(i, e, t) {
|
|
|
689
693
|
return new e(`Type error (${t}): ${i.message}`, i);
|
|
690
694
|
if (i instanceof ReferenceError)
|
|
691
695
|
return new e(`Reference error (${t}): ${i.message}`, i);
|
|
692
|
-
if (i instanceof
|
|
696
|
+
if (i instanceof N)
|
|
693
697
|
return i;
|
|
694
698
|
const s = i instanceof Error ? i.message : String(i), n = i instanceof Error ? i : null;
|
|
695
699
|
return new e(`Unexpected error (${t}): ${s}`, n);
|
|
@@ -705,7 +709,7 @@ function Ne(i) {
|
|
|
705
709
|
}
|
|
706
710
|
return ge(i) && "invalidate" in i && typeof i.invalidate == "function";
|
|
707
711
|
}
|
|
708
|
-
function
|
|
712
|
+
function Te(i) {
|
|
709
713
|
return i !== null && typeof i == "object" && "dispose" in i && "run" in i && typeof i.dispose == "function" && typeof i.run == "function";
|
|
710
714
|
}
|
|
711
715
|
function te(i) {
|
|
@@ -736,7 +740,7 @@ class be {
|
|
|
736
740
|
class ie extends Z {
|
|
737
741
|
constructor(e, t = {}) {
|
|
738
742
|
if (typeof e != "function")
|
|
739
|
-
throw new
|
|
743
|
+
throw new D(l.COMPUTED_MUST_BE_FUNCTION);
|
|
740
744
|
if (super(), this.MAX_ASYNC_RETRIES = 3, this._value = void 0, this.flags = u.DIRTY | u.IDLE, this._error = null, this._promiseId = 0, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : Y, this._hasDefaultValue = this._defaultValue !== Y, this._onError = t.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._fnSubs = [], this._objSubs = [], this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._trackable = new be(this), I.attachDebugInfo(this, "computed", this.id), I.enabled) {
|
|
741
745
|
const s = this;
|
|
742
746
|
s.subscriberCount = this.subscriberCount.bind(this), s.isDirty = () => (this.flags & u.DIRTY) !== 0, s.dependencies = this._dependencies, s.stateFlags = "";
|
|
@@ -749,11 +753,13 @@ class ie extends Z {
|
|
|
749
753
|
}
|
|
750
754
|
get value() {
|
|
751
755
|
const e = f.current;
|
|
752
|
-
e &&
|
|
756
|
+
e && T(this, e, this._fnSubs, this._objSubs);
|
|
753
757
|
const t = this.flags;
|
|
758
|
+
if (t & u.DISPOSED)
|
|
759
|
+
throw new D(l.COMPUTED_DISPOSED);
|
|
754
760
|
if (t & u.RECOMPUTING) {
|
|
755
761
|
if (this._hasDefaultValue) return this._defaultValue;
|
|
756
|
-
throw new
|
|
762
|
+
throw new D(l.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
757
763
|
}
|
|
758
764
|
t & (u.DIRTY | u.IDLE) && this._recompute();
|
|
759
765
|
const s = this.flags;
|
|
@@ -764,11 +770,11 @@ class ie extends Z {
|
|
|
764
770
|
}
|
|
765
771
|
get state() {
|
|
766
772
|
const e = f.current;
|
|
767
|
-
return e &&
|
|
773
|
+
return e && T(this, e, this._fnSubs, this._objSubs), B[this.flags & se];
|
|
768
774
|
}
|
|
769
775
|
get hasError() {
|
|
770
776
|
const e = f.current;
|
|
771
|
-
if (e &&
|
|
777
|
+
if (e && T(this, e, this._fnSubs, this._objSubs), this.flags & (u.REJECTED | u.HAS_ERROR)) return !0;
|
|
772
778
|
const s = this._dependencies;
|
|
773
779
|
for (let n = 0, r = s.length; n < r; n++) {
|
|
774
780
|
const o = s[n];
|
|
@@ -781,7 +787,7 @@ class ie extends Z {
|
|
|
781
787
|
}
|
|
782
788
|
get errors() {
|
|
783
789
|
const e = f.current;
|
|
784
|
-
if (e &&
|
|
790
|
+
if (e && T(this, e, this._fnSubs, this._objSubs), !this.hasError) return re;
|
|
785
791
|
const t = ae();
|
|
786
792
|
if (this._errorCacheEpoch === t && this._cachedErrors !== null)
|
|
787
793
|
return this._cachedErrors;
|
|
@@ -803,20 +809,20 @@ class ie extends Z {
|
|
|
803
809
|
}
|
|
804
810
|
get lastError() {
|
|
805
811
|
const e = f.current;
|
|
806
|
-
return e &&
|
|
812
|
+
return e && T(this, e, this._fnSubs, this._objSubs), this._error;
|
|
807
813
|
}
|
|
808
814
|
get isPending() {
|
|
809
815
|
const e = f.current;
|
|
810
|
-
return e &&
|
|
816
|
+
return e && T(this, e, this._fnSubs, this._objSubs), (this.flags & u.PENDING) !== 0;
|
|
811
817
|
}
|
|
812
818
|
get isResolved() {
|
|
813
819
|
const e = f.current;
|
|
814
|
-
return e &&
|
|
820
|
+
return e && T(this, e, this._fnSubs, this._objSubs), (this.flags & u.RESOLVED) !== 0;
|
|
815
821
|
}
|
|
816
822
|
invalidate() {
|
|
817
823
|
this._markDirty();
|
|
818
824
|
const e = this._dependencyVersions;
|
|
819
|
-
e !== p && (
|
|
825
|
+
e !== p && (C.release(e), this._dependencyVersions = p), this._errorCacheEpoch = -1, this._cachedErrors = null;
|
|
820
826
|
}
|
|
821
827
|
dispose() {
|
|
822
828
|
const e = this._unsubscribes;
|
|
@@ -830,7 +836,7 @@ class ie extends Z {
|
|
|
830
836
|
const t = this._dependencies;
|
|
831
837
|
t !== d && (x.release(t), this._dependencies = d);
|
|
832
838
|
const s = this._dependencyVersions;
|
|
833
|
-
s !== p && (
|
|
839
|
+
s !== p && (C.release(s), this._dependencyVersions = p), this._fnSubs = [], this._objSubs = [], this.flags = u.DISPOSED | u.DIRTY | u.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
834
840
|
}
|
|
835
841
|
_clearDirty() {
|
|
836
842
|
this.flags &= -9;
|
|
@@ -859,7 +865,7 @@ class ie extends Z {
|
|
|
859
865
|
return;
|
|
860
866
|
this._setRecomputing(!0);
|
|
861
867
|
const e = this._trackable, t = this._dependencies, s = this._dependencyVersions;
|
|
862
|
-
e._epoch = ee(), e._nextDeps = x.acquire(), e._nextVersions =
|
|
868
|
+
e._epoch = ee(), e._nextDeps = x.acquire(), e._nextVersions = C.acquire(), e._depCount = 0;
|
|
863
869
|
let n = !1;
|
|
864
870
|
try {
|
|
865
871
|
const r = f.run(e, this._fn), o = e._nextDeps, c = e._nextVersions, h = e._depCount;
|
|
@@ -875,7 +881,7 @@ class ie extends Z {
|
|
|
875
881
|
}
|
|
876
882
|
this._handleComputationError(o);
|
|
877
883
|
} finally {
|
|
878
|
-
n ? (t !== d && x.release(t), s !== p &&
|
|
884
|
+
n ? (t !== d && x.release(t), s !== p && C.release(s)) : (x.release(e._nextDeps), C.release(e._nextVersions)), e.reset(), this._setRecomputing(!1);
|
|
879
885
|
}
|
|
880
886
|
}
|
|
881
887
|
_handleAsyncComputation(e) {
|
|
@@ -888,7 +894,7 @@ class ie extends Z {
|
|
|
888
894
|
this._asyncRetryCount++, this._markDirty();
|
|
889
895
|
return;
|
|
890
896
|
}
|
|
891
|
-
const o = new
|
|
897
|
+
const o = new D(
|
|
892
898
|
`Async drift exceeded threshold after ${this.MAX_ASYNC_RETRIES} retries.`
|
|
893
899
|
);
|
|
894
900
|
this._handleAsyncRejection(o);
|
|
@@ -912,7 +918,7 @@ class ie extends Z {
|
|
|
912
918
|
return e;
|
|
913
919
|
}
|
|
914
920
|
_handleAsyncRejection(e) {
|
|
915
|
-
const t = m(e,
|
|
921
|
+
const t = m(e, D, l.COMPUTED_ASYNC_COMPUTATION_FAILED);
|
|
916
922
|
this.flags & u.REJECTED || (this.version = this.version + 1 & A), this._error = t, this._setRejected(), this._clearDirty();
|
|
917
923
|
const s = this._onError;
|
|
918
924
|
if (s)
|
|
@@ -927,7 +933,7 @@ class ie extends Z {
|
|
|
927
933
|
(!(this.flags & u.RESOLVED) || !this._equal(this._value, e)) && (this.version = this.version + 1 & A), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1), this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
928
934
|
}
|
|
929
935
|
_handleComputationError(e) {
|
|
930
|
-
const t = m(e,
|
|
936
|
+
const t = m(e, D, l.COMPUTED_COMPUTATION_FAILED);
|
|
931
937
|
this._error = t, this._setRejected(), this._clearDirty(), this._setRecomputing(!1);
|
|
932
938
|
const s = this._onError;
|
|
933
939
|
if (s)
|
|
@@ -941,7 +947,7 @@ class ie extends Z {
|
|
|
941
947
|
_handlePending() {
|
|
942
948
|
if (this._hasDefaultValue)
|
|
943
949
|
return this._defaultValue;
|
|
944
|
-
throw new
|
|
950
|
+
throw new D(l.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
945
951
|
}
|
|
946
952
|
_handleRejected() {
|
|
947
953
|
const e = this._error;
|
|
@@ -959,13 +965,13 @@ class ie extends Z {
|
|
|
959
965
|
}
|
|
960
966
|
}
|
|
961
967
|
Object.freeze(ie.prototype);
|
|
962
|
-
function
|
|
968
|
+
function Re(i, e = {}) {
|
|
963
969
|
return new ie(i, e);
|
|
964
970
|
}
|
|
965
971
|
class Ie extends W {
|
|
966
972
|
constructor(e, t = {}) {
|
|
967
|
-
super(), this._cleanup = null, this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._executeTask = void 0, this._onError = t.onError ?? null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ??
|
|
968
|
-
const s = Number.isFinite(this._maxExecutions), n = s ? Math.min(this._maxExecutions + 1,
|
|
973
|
+
super(), this._cleanup = null, this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._executeTask = void 0, this._onError = t.onError ?? null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? R.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? R.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1, this._executionCount = 0, this._historyPtr = 0;
|
|
974
|
+
const s = Number.isFinite(this._maxExecutions), n = s ? Math.min(this._maxExecutions + 1, R.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
|
|
969
975
|
this._historyCapacity = n, this._history = E && s && n > 0 ? new Array(n).fill(0) : null, this._execId = 0, I.attachDebugInfo(this, "effect", this.id);
|
|
970
976
|
}
|
|
971
977
|
run() {
|
|
@@ -988,7 +994,7 @@ class Ie extends W {
|
|
|
988
994
|
const s = this._dependencies;
|
|
989
995
|
s !== d && (x.release(s), this._dependencies = d);
|
|
990
996
|
const n = this._dependencyVersions;
|
|
991
|
-
n !== p && (
|
|
997
|
+
n !== p && (C.release(n), this._dependencyVersions = p), this._executeTask = void 0;
|
|
992
998
|
}
|
|
993
999
|
addDependency(e) {
|
|
994
1000
|
if (!(this.flags & S.EXECUTING)) return;
|
|
@@ -1032,7 +1038,7 @@ class Ie extends W {
|
|
|
1032
1038
|
}
|
|
1033
1039
|
}
|
|
1034
1040
|
_prepareEffectExecutionContext() {
|
|
1035
|
-
const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, n = x.acquire(), r =
|
|
1041
|
+
const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, n = x.acquire(), r = C.acquire(), o = U.acquire(), c = ee();
|
|
1036
1042
|
if (e !== d)
|
|
1037
1043
|
for (let h = 0, _ = e.length; h < _; h++) {
|
|
1038
1044
|
const a = e[h];
|
|
@@ -1051,9 +1057,9 @@ class Ie extends W {
|
|
|
1051
1057
|
}
|
|
1052
1058
|
x.release(s);
|
|
1053
1059
|
}
|
|
1054
|
-
e.prevUnsubs !== O && U.release(e.prevUnsubs), e.prevVersions !== p &&
|
|
1060
|
+
e.prevUnsubs !== O && U.release(e.prevUnsubs), e.prevVersions !== p && C.release(e.prevVersions);
|
|
1055
1061
|
} else {
|
|
1056
|
-
x.release(e.nextDeps),
|
|
1062
|
+
x.release(e.nextDeps), C.release(e.nextVersions);
|
|
1057
1063
|
const n = e.nextUnsubs;
|
|
1058
1064
|
for (let r = 0, o = n.length; r < o; r++)
|
|
1059
1065
|
n[r]?.();
|
|
@@ -1108,7 +1114,7 @@ class Ie extends W {
|
|
|
1108
1114
|
}
|
|
1109
1115
|
_checkInfiniteLoop() {
|
|
1110
1116
|
const e = H;
|
|
1111
|
-
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), fe() >
|
|
1117
|
+
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), fe() > R.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
|
|
1112
1118
|
const s = this._history;
|
|
1113
1119
|
if (s) {
|
|
1114
1120
|
const n = Date.now(), r = this._historyPtr, o = this._historyCapacity;
|
|
@@ -1181,7 +1187,7 @@ function Oe(i, e = {}) {
|
|
|
1181
1187
|
}
|
|
1182
1188
|
function xe(i) {
|
|
1183
1189
|
if (typeof i != "function")
|
|
1184
|
-
throw new
|
|
1190
|
+
throw new N("Batch callback must be a function");
|
|
1185
1191
|
F.startBatch();
|
|
1186
1192
|
try {
|
|
1187
1193
|
return i();
|
|
@@ -1191,21 +1197,21 @@ function xe(i) {
|
|
|
1191
1197
|
}
|
|
1192
1198
|
export {
|
|
1193
1199
|
M as AsyncState,
|
|
1194
|
-
|
|
1195
|
-
|
|
1200
|
+
N as AtomError,
|
|
1201
|
+
D as ComputedError,
|
|
1196
1202
|
G as DEBUG_CONFIG,
|
|
1197
1203
|
I as DEBUG_RUNTIME,
|
|
1198
1204
|
y as EffectError,
|
|
1199
1205
|
De as POOL_CONFIG,
|
|
1200
|
-
|
|
1206
|
+
R as SCHEDULER_CONFIG,
|
|
1201
1207
|
P as SchedulerError,
|
|
1202
1208
|
Ce as atom,
|
|
1203
1209
|
xe as batch,
|
|
1204
|
-
|
|
1210
|
+
Re as computed,
|
|
1205
1211
|
Oe as effect,
|
|
1206
1212
|
ge as isAtom,
|
|
1207
1213
|
Ne as isComputed,
|
|
1208
|
-
|
|
1214
|
+
Te as isEffect,
|
|
1209
1215
|
F as scheduler,
|
|
1210
1216
|
pe as untracked
|
|
1211
1217
|
};
|