mobx 6.3.4 → 6.3.8

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.
@@ -1535,22 +1535,21 @@ var ComputedValue = /*#__PURE__*/function () {
1535
1535
  /* see #1208 */
1536
1536
  this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;
1537
1537
  var newValue = this.computeValue_(true);
1538
-
1539
- if ( isSpyEnabled()) {
1540
- spyReport({
1541
- observableKind: "computed",
1542
- debugObjectName: this.name_,
1543
- object: this.scope_,
1544
- type: "update",
1545
- oldValue: this.value_,
1546
- newValue: newValue
1547
- });
1548
- }
1549
-
1550
1538
  var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);
1551
1539
 
1552
1540
  if (changed) {
1553
1541
  this.value_ = newValue;
1542
+
1543
+ if ( isSpyEnabled()) {
1544
+ spyReport({
1545
+ observableKind: "computed",
1546
+ debugObjectName: this.name_,
1547
+ object: this.scope_,
1548
+ type: "update",
1549
+ oldValue: oldValue,
1550
+ newValue: newValue
1551
+ });
1552
+ }
1554
1553
  }
1555
1554
 
1556
1555
  return changed;
@@ -2649,8 +2648,7 @@ function reaction(expression, effect, opts) {
2649
2648
  var firstTime = true;
2650
2649
  var isScheduled = false;
2651
2650
  var value;
2652
- var oldValue = undefined; // only an issue with fireImmediately
2653
-
2651
+ var oldValue;
2654
2652
  var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer["default"];
2655
2653
  var r = new Reaction(name, function () {
2656
2654
  if (firstTime || runSync) {
@@ -3323,7 +3321,7 @@ function whenPromise(predicate, opts) {
3323
3321
 
3324
3322
  cancel = function cancel() {
3325
3323
  disposer();
3326
- reject("WHEN_CANCELLED");
3324
+ reject(new Error("WHEN_CANCELLED"));
3327
3325
  };
3328
3326
  });
3329
3327
  res.cancel = cancel;
@@ -3454,7 +3452,11 @@ function makeObservable(target, annotations, options) {
3454
3452
  try {
3455
3453
  var _annotations;
3456
3454
 
3457
- // Default to decorators
3455
+ if ("development" !== "production" && annotations && target[storedAnnotationsSymbol]) {
3456
+ die("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.");
3457
+ } // Default to decorators
3458
+
3459
+
3458
3460
  (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target); // Annotate
3459
3461
 
3460
3462
  ownKeys(annotations).forEach(function (key) {
@@ -3677,9 +3679,12 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3677
3679
 
3678
3680
  return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));
3679
3681
  } else {
3680
- var res = this.values_.slice(index, index + deleteCount);
3681
- var oldItems = this.values_.slice(index + deleteCount);
3682
- this.values_.length = index + newItems.length - deleteCount;
3682
+ // The items removed by the splice
3683
+ var res = this.values_.slice(index, index + deleteCount); // The items that that should remain at the end of the array
3684
+
3685
+ var oldItems = this.values_.slice(index + deleteCount); // New length is the previous length + addition count - deletion count
3686
+
3687
+ this.values_.length += newItems.length - deleteCount;
3683
3688
 
3684
3689
  for (var i = 0; i < newItems.length; i++) {
3685
3690
  this.values_[index + i] = newItems[i];