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
|
@@ -442,14 +442,12 @@
|
|
|
442
442
|
this.isPendingUnobservation_ = false;
|
|
443
443
|
this.isBeingObserved_ = false;
|
|
444
444
|
this.observers_ = new Set();
|
|
445
|
-
this.batchId_ = void 0;
|
|
446
445
|
this.diffValue_ = 0;
|
|
447
446
|
this.lastAccessedBy_ = 0;
|
|
448
447
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
449
448
|
this.onBOL = void 0;
|
|
450
449
|
this.onBUOL = void 0;
|
|
451
450
|
this.name_ = name_;
|
|
452
|
-
this.batchId_ = globalState.inBatch ? globalState.batchId : NaN;
|
|
453
451
|
}
|
|
454
452
|
// onBecomeObservedListeners
|
|
455
453
|
var _proto = Atom.prototype;
|
|
@@ -478,13 +476,6 @@
|
|
|
478
476
|
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
|
|
479
477
|
*/;
|
|
480
478
|
_proto.reportChanged = function reportChanged() {
|
|
481
|
-
if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
|
|
482
|
-
// We could update state version only at the end of batch,
|
|
483
|
-
// but we would still have to switch some global flag here to signal a change.
|
|
484
|
-
globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
|
|
485
|
-
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
486
|
-
this.batchId_ = NaN;
|
|
487
|
-
}
|
|
488
479
|
startBatch();
|
|
489
480
|
propagateChanged(this);
|
|
490
481
|
endBatch();
|
|
@@ -1237,6 +1228,9 @@
|
|
|
1237
1228
|
return executeAction(actionName, autoAction, fn, ref || this, arguments);
|
|
1238
1229
|
}
|
|
1239
1230
|
res.isMobxAction = true;
|
|
1231
|
+
res.toString = function () {
|
|
1232
|
+
return fn.toString();
|
|
1233
|
+
};
|
|
1240
1234
|
if (isFunctionNameConfigurable) {
|
|
1241
1235
|
tmpNameDescriptor.value = actionName;
|
|
1242
1236
|
defineProperty(res, "name", tmpNameDescriptor);
|
|
@@ -1984,7 +1978,6 @@
|
|
|
1984
1978
|
this.runId = 0;
|
|
1985
1979
|
this.mobxGuid = 0;
|
|
1986
1980
|
this.inBatch = 0;
|
|
1987
|
-
this.batchId = Number.MIN_SAFE_INTEGER;
|
|
1988
1981
|
this.pendingUnobservations = [];
|
|
1989
1982
|
this.pendingReactions = [];
|
|
1990
1983
|
this.isRunningReactions = false;
|
|
@@ -2001,7 +1994,6 @@
|
|
|
2001
1994
|
this.useProxies = true;
|
|
2002
1995
|
this.verifyProxies = false;
|
|
2003
1996
|
this.safeDescriptors = true;
|
|
2004
|
-
this.stateVersion = Number.MIN_SAFE_INTEGER;
|
|
2005
1997
|
};
|
|
2006
1998
|
var canMergeGlobalState = true;
|
|
2007
1999
|
var isolateCalled = false;
|
|
@@ -2124,9 +2116,6 @@
|
|
|
2124
2116
|
* Avoids unnecessary recalculations.
|
|
2125
2117
|
*/
|
|
2126
2118
|
function startBatch() {
|
|
2127
|
-
if (globalState.inBatch === 0) {
|
|
2128
|
-
globalState.batchId = globalState.batchId < Number.MAX_SAFE_INTEGER ? globalState.batchId + 1 : Number.MIN_SAFE_INTEGER;
|
|
2129
|
-
}
|
|
2130
2119
|
globalState.inBatch++;
|
|
2131
2120
|
}
|
|
2132
2121
|
function endBatch() {
|
|
@@ -3963,6 +3952,7 @@
|
|
|
3963
3952
|
* Without this, everything works as well, but this works
|
|
3964
3953
|
* faster as everything works on unproxied values
|
|
3965
3954
|
*/
|
|
3955
|
+
addArrayExtension("at", simpleFunc);
|
|
3966
3956
|
addArrayExtension("concat", simpleFunc);
|
|
3967
3957
|
addArrayExtension("flat", simpleFunc);
|
|
3968
3958
|
addArrayExtension("includes", simpleFunc);
|
|
@@ -3972,15 +3962,21 @@
|
|
|
3972
3962
|
addArrayExtension("slice", simpleFunc);
|
|
3973
3963
|
addArrayExtension("toString", simpleFunc);
|
|
3974
3964
|
addArrayExtension("toLocaleString", simpleFunc);
|
|
3965
|
+
addArrayExtension("toSorted", simpleFunc);
|
|
3966
|
+
addArrayExtension("toSpliced", simpleFunc);
|
|
3967
|
+
addArrayExtension("with", simpleFunc);
|
|
3975
3968
|
// map
|
|
3976
3969
|
addArrayExtension("every", mapLikeFunc);
|
|
3977
3970
|
addArrayExtension("filter", mapLikeFunc);
|
|
3978
3971
|
addArrayExtension("find", mapLikeFunc);
|
|
3979
3972
|
addArrayExtension("findIndex", mapLikeFunc);
|
|
3973
|
+
addArrayExtension("findLast", mapLikeFunc);
|
|
3974
|
+
addArrayExtension("findLastIndex", mapLikeFunc);
|
|
3980
3975
|
addArrayExtension("flatMap", mapLikeFunc);
|
|
3981
3976
|
addArrayExtension("forEach", mapLikeFunc);
|
|
3982
3977
|
addArrayExtension("map", mapLikeFunc);
|
|
3983
3978
|
addArrayExtension("some", mapLikeFunc);
|
|
3979
|
+
addArrayExtension("toReversed", mapLikeFunc);
|
|
3984
3980
|
// reduce
|
|
3985
3981
|
addArrayExtension("reduce", reduceLikeFunc);
|
|
3986
3982
|
addArrayExtension("reduceRight", reduceLikeFunc);
|