mobx 6.13.5 → 6.13.7

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # mobx
2
2
 
3
+ ## 6.13.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`54e3f71ca02f09b3107290f18d8484b70a6e2f0b`](https://github.com/mobxjs/mobx/commit/54e3f71ca02f09b3107290f18d8484b70a6e2f0b) [#4528](https://github.com/mobxjs/mobx/pull/4528) Thanks [@k-g-a](https://github.com/k-g-a)! - Fix observable.set not respecting the new value from interceptors
8
+
9
+ ## 6.13.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`bca3841347f4fba50ad910e1c4176c56ba0173d1`](https://github.com/mobxjs/mobx/commit/bca3841347f4fba50ad910e1c4176c56ba0173d1) [#3993](https://github.com/mobxjs/mobx/pull/3993) Thanks [@tonyraoul](https://github.com/tonyraoul)! - Improve observableset memory footprint and performance
14
+
3
15
  ## 6.13.5
4
16
 
5
17
  ### Patch Changes
@@ -4682,8 +4682,8 @@ var ObservableSet = /*#__PURE__*/function () {
4682
4682
  if (!change) {
4683
4683
  return this;
4684
4684
  }
4685
- // ideally, value = change.value would be done here, so that values can be
4686
- // changed by interceptor. Same applies for other Set and Map api's.
4685
+ // implemented reassignment same as it's done for ObservableMap
4686
+ value = change.newValue;
4687
4687
  }
4688
4688
  if (!this.has(value)) {
4689
4689
  transaction(function () {
@@ -4755,19 +4755,18 @@ var ObservableSet = /*#__PURE__*/function () {
4755
4755
  return this.data_.has(this.dehanceValue_(value));
4756
4756
  };
4757
4757
  _proto.entries = function entries() {
4758
- var nextIndex = 0;
4759
- var keys = Array.from(this.keys());
4760
- var values = Array.from(this.values());
4758
+ var values = this.values();
4761
4759
  return makeIterableForSet({
4762
4760
  next: function next() {
4763
- var index = nextIndex;
4764
- nextIndex += 1;
4765
- return index < values.length ? {
4766
- value: [keys[index], values[index]],
4767
- done: false
4761
+ var _values$next = values.next(),
4762
+ value = _values$next.value,
4763
+ done = _values$next.done;
4764
+ return !done ? {
4765
+ value: [value, value],
4766
+ done: done
4768
4767
  } : {
4769
4768
  value: undefined,
4770
- done: true
4769
+ done: done
4771
4770
  };
4772
4771
  }
4773
4772
  });
@@ -4778,16 +4777,18 @@ var ObservableSet = /*#__PURE__*/function () {
4778
4777
  _proto.values = function values() {
4779
4778
  this.atom_.reportObserved();
4780
4779
  var self = this;
4781
- var nextIndex = 0;
4782
- var observableValues = Array.from(this.data_.values());
4780
+ var values = this.data_.values();
4783
4781
  return makeIterableForSet({
4784
4782
  next: function next() {
4785
- return nextIndex < observableValues.length ? {
4786
- value: self.dehanceValue_(observableValues[nextIndex++]),
4787
- done: false
4783
+ var _values$next2 = values.next(),
4784
+ value = _values$next2.value,
4785
+ done = _values$next2.done;
4786
+ return !done ? {
4787
+ value: self.dehanceValue_(value),
4788
+ done: done
4788
4789
  } : {
4789
4790
  value: undefined,
4790
- done: true
4791
+ done: done
4791
4792
  };
4792
4793
  }
4793
4794
  });
@@ -5737,6 +5738,8 @@ function deepEqual(a, b, depth) {
5737
5738
  return eq(a, b, depth);
5738
5739
  }
5739
5740
  // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
5741
+ // Modified: "Deep compare objects" part to iterate over keys in forward order instead of reverse order.
5742
+ //
5740
5743
  // Internal recursive comparison function for `isEqual`.
5741
5744
  function eq(a, b, depth, aStack, bStack) {
5742
5745
  // Identical objects are equal. `0 === -0`, but they aren't identical.
@@ -5849,15 +5852,14 @@ function eq(a, b, depth, aStack, bStack) {
5849
5852
  } else {
5850
5853
  // Deep compare objects.
5851
5854
  var keys = Object.keys(a);
5852
- var key;
5853
- length = keys.length;
5855
+ var _length = keys.length;
5854
5856
  // Ensure that both objects contain the same number of properties before comparing deep equality.
5855
- if (Object.keys(b).length !== length) {
5857
+ if (Object.keys(b).length !== _length) {
5856
5858
  return false;
5857
5859
  }
5858
- while (length--) {
5860
+ for (var i = 0; i < _length; i++) {
5859
5861
  // Deep compare each member
5860
- key = keys[length];
5862
+ var key = keys[i];
5861
5863
  if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
5862
5864
  return false;
5863
5865
  }