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.
@@ -1012,7 +1012,8 @@
1012
1012
  // lone setter -> action setter
1013
1013
  if (descriptor.set) {
1014
1014
  // TODO make action applicable to setter and delegate to action.make_
1015
- var set = createAction(key.toString(), descriptor.set);
1015
+ var set = isAction(descriptor.set) ? descriptor.set // See #4553
1016
+ : createAction(key.toString(), descriptor.set);
1016
1017
  // own
1017
1018
  if (source === adm.target_) {
1018
1019
  return adm.defineProperty_(key, {
@@ -1377,13 +1378,14 @@
1377
1378
  _this.equals = equals;
1378
1379
  _this.value_ = enhancer(value, undefined, name_);
1379
1380
  if ( notifySpy && isSpyEnabled()) {
1381
+ var _this$value_;
1380
1382
  // only notify spy if this is a stand-alone observable
1381
1383
  spyReport({
1382
1384
  type: CREATE,
1383
1385
  object: _this,
1384
1386
  observableKind: "value",
1385
1387
  debugObjectName: _this.name_,
1386
- newValue: "" + _this.value_
1388
+ newValue: "" + ((_this$value_ = _this.value_) == null ? void 0 : _this$value_.toString())
1387
1389
  });
1388
1390
  }
1389
1391
  return _this;
@@ -2551,6 +2553,9 @@
2551
2553
  };
2552
2554
  abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
2553
2555
  dispose[$mobx] = this;
2556
+ if ("dispose" in Symbol && typeof Symbol.dispose === "symbol") {
2557
+ dispose[Symbol.dispose] = dispose;
2558
+ }
2554
2559
  return dispose;
2555
2560
  };
2556
2561
  _proto.toString = function toString() {
@@ -4684,8 +4689,8 @@
4684
4689
  if (!change) {
4685
4690
  return this;
4686
4691
  }
4687
- // ideally, value = change.value would be done here, so that values can be
4688
- // changed by interceptor. Same applies for other Set and Map api's.
4692
+ // implemented reassignment same as it's done for ObservableMap
4693
+ value = change.newValue;
4689
4694
  }
4690
4695
  if (!this.has(value)) {
4691
4696
  transaction(function () {
@@ -5740,6 +5745,8 @@
5740
5745
  return eq(a, b, depth);
5741
5746
  }
5742
5747
  // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
5748
+ // Modified: "Deep compare objects" part to iterate over keys in forward order instead of reverse order.
5749
+ //
5743
5750
  // Internal recursive comparison function for `isEqual`.
5744
5751
  function eq(a, b, depth, aStack, bStack) {
5745
5752
  // Identical objects are equal. `0 === -0`, but they aren't identical.
@@ -5852,15 +5859,14 @@
5852
5859
  } else {
5853
5860
  // Deep compare objects.
5854
5861
  var keys = Object.keys(a);
5855
- var key;
5856
- length = keys.length;
5862
+ var _length = keys.length;
5857
5863
  // Ensure that both objects contain the same number of properties before comparing deep equality.
5858
- if (Object.keys(b).length !== length) {
5864
+ if (Object.keys(b).length !== _length) {
5859
5865
  return false;
5860
5866
  }
5861
- while (length--) {
5867
+ for (var i = 0; i < _length; i++) {
5862
5868
  // Deep compare each member
5863
- key = keys[length];
5869
+ var key = keys[i];
5864
5870
  if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
5865
5871
  return false;
5866
5872
  }