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.
@@ -1006,7 +1006,8 @@ function make_$5(adm, key, descriptor, source) {
1006
1006
  // lone setter -> action setter
1007
1007
  if (descriptor.set) {
1008
1008
  // TODO make action applicable to setter and delegate to action.make_
1009
- var set = createAction(key.toString(), descriptor.set);
1009
+ var set = isAction(descriptor.set) ? descriptor.set // See #4553
1010
+ : createAction(key.toString(), descriptor.set);
1010
1011
  // own
1011
1012
  if (source === adm.target_) {
1012
1013
  return adm.defineProperty_(key, {
@@ -1371,13 +1372,14 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
1371
1372
  _this.equals = equals;
1372
1373
  _this.value_ = enhancer(value, undefined, name_);
1373
1374
  if ( notifySpy && isSpyEnabled()) {
1375
+ var _this$value_;
1374
1376
  // only notify spy if this is a stand-alone observable
1375
1377
  spyReport({
1376
1378
  type: CREATE,
1377
1379
  object: _this,
1378
1380
  observableKind: "value",
1379
1381
  debugObjectName: _this.name_,
1380
- newValue: "" + _this.value_
1382
+ newValue: "" + ((_this$value_ = _this.value_) == null ? void 0 : _this$value_.toString())
1381
1383
  });
1382
1384
  }
1383
1385
  return _this;
@@ -2545,6 +2547,9 @@ var Reaction = /*#__PURE__*/function () {
2545
2547
  };
2546
2548
  abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
2547
2549
  dispose[$mobx] = this;
2550
+ if ("dispose" in Symbol && typeof Symbol.dispose === "symbol") {
2551
+ dispose[Symbol.dispose] = dispose;
2552
+ }
2548
2553
  return dispose;
2549
2554
  };
2550
2555
  _proto.toString = function toString() {
@@ -4678,8 +4683,8 @@ var ObservableSet = /*#__PURE__*/function () {
4678
4683
  if (!change) {
4679
4684
  return this;
4680
4685
  }
4681
- // ideally, value = change.value would be done here, so that values can be
4682
- // changed by interceptor. Same applies for other Set and Map api's.
4686
+ // implemented reassignment same as it's done for ObservableMap
4687
+ value = change.newValue;
4683
4688
  }
4684
4689
  if (!this.has(value)) {
4685
4690
  transaction(function () {
@@ -5734,6 +5739,8 @@ function deepEqual(a, b, depth) {
5734
5739
  return eq(a, b, depth);
5735
5740
  }
5736
5741
  // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
5742
+ // Modified: "Deep compare objects" part to iterate over keys in forward order instead of reverse order.
5743
+ //
5737
5744
  // Internal recursive comparison function for `isEqual`.
5738
5745
  function eq(a, b, depth, aStack, bStack) {
5739
5746
  // Identical objects are equal. `0 === -0`, but they aren't identical.
@@ -5846,15 +5853,14 @@ function eq(a, b, depth, aStack, bStack) {
5846
5853
  } else {
5847
5854
  // Deep compare objects.
5848
5855
  var keys = Object.keys(a);
5849
- var key;
5850
- length = keys.length;
5856
+ var _length = keys.length;
5851
5857
  // Ensure that both objects contain the same number of properties before comparing deep equality.
5852
- if (Object.keys(b).length !== length) {
5858
+ if (Object.keys(b).length !== _length) {
5853
5859
  return false;
5854
5860
  }
5855
- while (length--) {
5861
+ for (var i = 0; i < _length; i++) {
5856
5862
  // Deep compare each member
5857
- key = keys[length];
5863
+ var key = keys[i];
5858
5864
  if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
5859
5865
  return false;
5860
5866
  }