mobx 6.12.0 → 6.12.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/CHANGELOG.md +16 -0
- package/dist/core/reaction.d.ts +2 -2
- package/dist/mobx.cjs.development.js +9 -8
- 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 +9 -8
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +9 -8
- 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 +9 -8
- 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/dist/types/observableobject.d.ts +3 -3
- package/package.json +1 -1
- package/src/api/autorun.ts +2 -3
- package/src/core/derivation.ts +6 -3
- package/src/core/reaction.ts +3 -2
- package/src/types/legacyobservablearray.ts +1 -1
- package/src/types/observablearray.ts +2 -2
- package/src/types/observableobject.ts +2 -2
|
@@ -1816,10 +1816,12 @@ function checkIfStateReadsAreAllowed(observable) {
|
|
|
1816
1816
|
*/
|
|
1817
1817
|
function trackDerivedFunction(derivation, f, context) {
|
|
1818
1818
|
var prevAllowStateReads = allowStateReadsStart(true);
|
|
1819
|
-
// pre allocate array allocation + room for variation in deps
|
|
1820
|
-
// array will be trimmed by bindDependencies
|
|
1821
1819
|
changeDependenciesStateTo0(derivation);
|
|
1822
|
-
|
|
1820
|
+
// Preallocate array; will be trimmed by bindDependencies.
|
|
1821
|
+
derivation.newObserving_ = new Array(
|
|
1822
|
+
// Reserve constant space for initial dependencies, dynamic space otherwise.
|
|
1823
|
+
// See https://github.com/mobxjs/mobx/pull/3833
|
|
1824
|
+
derivation.runId_ === 0 ? 100 : derivation.observing_.length);
|
|
1823
1825
|
derivation.unboundDepsCount_ = 0;
|
|
1824
1826
|
derivation.runId_ = ++globalState.runId;
|
|
1825
1827
|
var prevTracking = globalState.trackingDerivation;
|
|
@@ -2660,7 +2662,6 @@ function reaction(expression, effect, opts) {
|
|
|
2660
2662
|
var firstTime = true;
|
|
2661
2663
|
var isScheduled = false;
|
|
2662
2664
|
var value;
|
|
2663
|
-
var oldValue;
|
|
2664
2665
|
var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer["default"];
|
|
2665
2666
|
var r = new Reaction(name, function () {
|
|
2666
2667
|
if (firstTime || runSync) {
|
|
@@ -2676,12 +2677,12 @@ function reaction(expression, effect, opts) {
|
|
|
2676
2677
|
return;
|
|
2677
2678
|
}
|
|
2678
2679
|
var changed = false;
|
|
2680
|
+
var oldValue = value;
|
|
2679
2681
|
r.track(function () {
|
|
2680
2682
|
var nextValue = allowStateChanges(false, function () {
|
|
2681
2683
|
return expression(r);
|
|
2682
2684
|
});
|
|
2683
2685
|
changed = firstTime || !equals(value, nextValue);
|
|
2684
|
-
oldValue = value;
|
|
2685
2686
|
value = nextValue;
|
|
2686
2687
|
});
|
|
2687
2688
|
if (firstTime && opts.fireImmediately) {
|
|
@@ -3988,7 +3989,7 @@ function simpleFunc(funcName) {
|
|
|
3988
3989
|
return dehancedValues[funcName].apply(dehancedValues, arguments);
|
|
3989
3990
|
};
|
|
3990
3991
|
}
|
|
3991
|
-
// Make sure callbacks
|
|
3992
|
+
// Make sure callbacks receive correct array arg #2326
|
|
3992
3993
|
function mapLikeFunc(funcName) {
|
|
3993
3994
|
return function (callback, thisArg) {
|
|
3994
3995
|
var _this2 = this;
|
|
@@ -4000,7 +4001,7 @@ function mapLikeFunc(funcName) {
|
|
|
4000
4001
|
});
|
|
4001
4002
|
};
|
|
4002
4003
|
}
|
|
4003
|
-
// Make sure callbacks
|
|
4004
|
+
// Make sure callbacks receive correct array arg #2326
|
|
4004
4005
|
function reduceLikeFunc(funcName) {
|
|
4005
4006
|
return function () {
|
|
4006
4007
|
var _this3 = this;
|
|
@@ -5333,7 +5334,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5333
5334
|
_this.spliceWithArray(0, 0, initialValues);
|
|
5334
5335
|
}
|
|
5335
5336
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5336
|
-
// Seems that Safari won't use numeric prototype setter
|
|
5337
|
+
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5337
5338
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5338
5339
|
Object.defineProperty(_assertThisInitialized(_this), "0", ENTRY_0);
|
|
5339
5340
|
}
|