mobx 6.13.6 → 6.15.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/dist/mobx.esm.js CHANGED
@@ -1007,7 +1007,8 @@ function make_$5(adm, key, descriptor, source) {
1007
1007
  // lone setter -> action setter
1008
1008
  if (descriptor.set) {
1009
1009
  // TODO make action applicable to setter and delegate to action.make_
1010
- var set = createAction(key.toString(), descriptor.set);
1010
+ var set = isAction(descriptor.set) ? descriptor.set // See #4553
1011
+ : createAction(key.toString(), descriptor.set);
1011
1012
  // own
1012
1013
  if (source === adm.target_) {
1013
1014
  return adm.defineProperty_(key, {
@@ -1372,13 +1373,14 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
1372
1373
  _this.equals = equals;
1373
1374
  _this.value_ = enhancer(value, undefined, name_);
1374
1375
  if (process.env.NODE_ENV !== "production" && notifySpy && isSpyEnabled()) {
1376
+ var _this$value_;
1375
1377
  // only notify spy if this is a stand-alone observable
1376
1378
  spyReport({
1377
1379
  type: CREATE,
1378
1380
  object: _this,
1379
1381
  observableKind: "value",
1380
1382
  debugObjectName: _this.name_,
1381
- newValue: "" + _this.value_
1383
+ newValue: "" + ((_this$value_ = _this.value_) == null ? void 0 : _this$value_.toString())
1382
1384
  });
1383
1385
  }
1384
1386
  return _this;
@@ -2555,6 +2557,9 @@ var Reaction = /*#__PURE__*/function () {
2555
2557
  };
2556
2558
  abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
2557
2559
  dispose[$mobx] = this;
2560
+ if ("dispose" in Symbol && typeof Symbol.dispose === "symbol") {
2561
+ dispose[Symbol.dispose] = dispose;
2562
+ }
2558
2563
  return dispose;
2559
2564
  };
2560
2565
  _proto.toString = function toString() {
@@ -4703,8 +4708,8 @@ var ObservableSet = /*#__PURE__*/function () {
4703
4708
  if (!change) {
4704
4709
  return this;
4705
4710
  }
4706
- // ideally, value = change.value would be done here, so that values can be
4707
- // changed by interceptor. Same applies for other Set and Map api's.
4711
+ // implemented reassignment same as it's done for ObservableMap
4712
+ value = change.newValue;
4708
4713
  }
4709
4714
  if (!this.has(value)) {
4710
4715
  transaction(function () {
@@ -5759,6 +5764,8 @@ function deepEqual(a, b, depth) {
5759
5764
  return eq(a, b, depth);
5760
5765
  }
5761
5766
  // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
5767
+ // Modified: "Deep compare objects" part to iterate over keys in forward order instead of reverse order.
5768
+ //
5762
5769
  // Internal recursive comparison function for `isEqual`.
5763
5770
  function eq(a, b, depth, aStack, bStack) {
5764
5771
  // Identical objects are equal. `0 === -0`, but they aren't identical.
@@ -5871,15 +5878,14 @@ function eq(a, b, depth, aStack, bStack) {
5871
5878
  } else {
5872
5879
  // Deep compare objects.
5873
5880
  var keys = Object.keys(a);
5874
- var key;
5875
- length = keys.length;
5881
+ var _length = keys.length;
5876
5882
  // Ensure that both objects contain the same number of properties before comparing deep equality.
5877
- if (Object.keys(b).length !== length) {
5883
+ if (Object.keys(b).length !== _length) {
5878
5884
  return false;
5879
5885
  }
5880
- while (length--) {
5886
+ for (var i = 0; i < _length; i++) {
5881
5887
  // Deep compare each member
5882
- key = keys[length];
5888
+ var key = keys[i];
5883
5889
  if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
5884
5890
  return false;
5885
5891
  }