mobx 6.11.0 → 6.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/CHANGELOG.md +10 -0
- package/README.md +27 -31
- package/dist/core/atom.d.ts +0 -1
- package/dist/core/globalstate.d.ts +0 -9
- package/dist/mobx.cjs.development.js +10 -14
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +10 -14
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +10 -14
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +10 -14
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core/action.ts +1 -0
- package/src/core/atom.ts +2 -17
- package/src/core/globalstate.ts +0 -11
- package/src/core/observable.ts +0 -6
- package/src/types/observablearray.ts +7 -0
|
@@ -436,14 +436,12 @@ var Atom = /*#__PURE__*/function () {
|
|
|
436
436
|
this.isPendingUnobservation_ = false;
|
|
437
437
|
this.isBeingObserved_ = false;
|
|
438
438
|
this.observers_ = new Set();
|
|
439
|
-
this.batchId_ = void 0;
|
|
440
439
|
this.diffValue_ = 0;
|
|
441
440
|
this.lastAccessedBy_ = 0;
|
|
442
441
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
443
442
|
this.onBOL = void 0;
|
|
444
443
|
this.onBUOL = void 0;
|
|
445
444
|
this.name_ = name_;
|
|
446
|
-
this.batchId_ = globalState.inBatch ? globalState.batchId : NaN;
|
|
447
445
|
}
|
|
448
446
|
// onBecomeObservedListeners
|
|
449
447
|
var _proto = Atom.prototype;
|
|
@@ -472,13 +470,6 @@ var Atom = /*#__PURE__*/function () {
|
|
|
472
470
|
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
|
|
473
471
|
*/;
|
|
474
472
|
_proto.reportChanged = function reportChanged() {
|
|
475
|
-
if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
|
|
476
|
-
// We could update state version only at the end of batch,
|
|
477
|
-
// but we would still have to switch some global flag here to signal a change.
|
|
478
|
-
globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
|
|
479
|
-
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
480
|
-
this.batchId_ = NaN;
|
|
481
|
-
}
|
|
482
473
|
startBatch();
|
|
483
474
|
propagateChanged(this);
|
|
484
475
|
endBatch();
|
|
@@ -1231,6 +1222,9 @@ function createAction(actionName, fn, autoAction, ref) {
|
|
|
1231
1222
|
return executeAction(actionName, autoAction, fn, ref || this, arguments);
|
|
1232
1223
|
}
|
|
1233
1224
|
res.isMobxAction = true;
|
|
1225
|
+
res.toString = function () {
|
|
1226
|
+
return fn.toString();
|
|
1227
|
+
};
|
|
1234
1228
|
if (isFunctionNameConfigurable) {
|
|
1235
1229
|
tmpNameDescriptor.value = actionName;
|
|
1236
1230
|
defineProperty(res, "name", tmpNameDescriptor);
|
|
@@ -1978,7 +1972,6 @@ var MobXGlobals = function MobXGlobals() {
|
|
|
1978
1972
|
this.runId = 0;
|
|
1979
1973
|
this.mobxGuid = 0;
|
|
1980
1974
|
this.inBatch = 0;
|
|
1981
|
-
this.batchId = Number.MIN_SAFE_INTEGER;
|
|
1982
1975
|
this.pendingUnobservations = [];
|
|
1983
1976
|
this.pendingReactions = [];
|
|
1984
1977
|
this.isRunningReactions = false;
|
|
@@ -1995,7 +1988,6 @@ var MobXGlobals = function MobXGlobals() {
|
|
|
1995
1988
|
this.useProxies = true;
|
|
1996
1989
|
this.verifyProxies = false;
|
|
1997
1990
|
this.safeDescriptors = true;
|
|
1998
|
-
this.stateVersion = Number.MIN_SAFE_INTEGER;
|
|
1999
1991
|
};
|
|
2000
1992
|
var canMergeGlobalState = true;
|
|
2001
1993
|
var isolateCalled = false;
|
|
@@ -2118,9 +2110,6 @@ function queueForUnobservation(observable) {
|
|
|
2118
2110
|
* Avoids unnecessary recalculations.
|
|
2119
2111
|
*/
|
|
2120
2112
|
function startBatch() {
|
|
2121
|
-
if (globalState.inBatch === 0) {
|
|
2122
|
-
globalState.batchId = globalState.batchId < Number.MAX_SAFE_INTEGER ? globalState.batchId + 1 : Number.MIN_SAFE_INTEGER;
|
|
2123
|
-
}
|
|
2124
2113
|
globalState.inBatch++;
|
|
2125
2114
|
}
|
|
2126
2115
|
function endBatch() {
|
|
@@ -3957,6 +3946,7 @@ var arrayExtensions = {
|
|
|
3957
3946
|
* Without this, everything works as well, but this works
|
|
3958
3947
|
* faster as everything works on unproxied values
|
|
3959
3948
|
*/
|
|
3949
|
+
addArrayExtension("at", simpleFunc);
|
|
3960
3950
|
addArrayExtension("concat", simpleFunc);
|
|
3961
3951
|
addArrayExtension("flat", simpleFunc);
|
|
3962
3952
|
addArrayExtension("includes", simpleFunc);
|
|
@@ -3966,15 +3956,21 @@ addArrayExtension("lastIndexOf", simpleFunc);
|
|
|
3966
3956
|
addArrayExtension("slice", simpleFunc);
|
|
3967
3957
|
addArrayExtension("toString", simpleFunc);
|
|
3968
3958
|
addArrayExtension("toLocaleString", simpleFunc);
|
|
3959
|
+
addArrayExtension("toSorted", simpleFunc);
|
|
3960
|
+
addArrayExtension("toSpliced", simpleFunc);
|
|
3961
|
+
addArrayExtension("with", simpleFunc);
|
|
3969
3962
|
// map
|
|
3970
3963
|
addArrayExtension("every", mapLikeFunc);
|
|
3971
3964
|
addArrayExtension("filter", mapLikeFunc);
|
|
3972
3965
|
addArrayExtension("find", mapLikeFunc);
|
|
3973
3966
|
addArrayExtension("findIndex", mapLikeFunc);
|
|
3967
|
+
addArrayExtension("findLast", mapLikeFunc);
|
|
3968
|
+
addArrayExtension("findLastIndex", mapLikeFunc);
|
|
3974
3969
|
addArrayExtension("flatMap", mapLikeFunc);
|
|
3975
3970
|
addArrayExtension("forEach", mapLikeFunc);
|
|
3976
3971
|
addArrayExtension("map", mapLikeFunc);
|
|
3977
3972
|
addArrayExtension("some", mapLikeFunc);
|
|
3973
|
+
addArrayExtension("toReversed", mapLikeFunc);
|
|
3978
3974
|
// reduce
|
|
3979
3975
|
addArrayExtension("reduce", reduceLikeFunc);
|
|
3980
3976
|
addArrayExtension("reduceRight", reduceLikeFunc);
|