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.
@@ -1541,22 +1541,21 @@
1541
1541
  /* see #1208 */
1542
1542
  this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;
1543
1543
  var newValue = this.computeValue_(true);
1544
-
1545
- if ( isSpyEnabled()) {
1546
- spyReport({
1547
- observableKind: "computed",
1548
- debugObjectName: this.name_,
1549
- object: this.scope_,
1550
- type: "update",
1551
- oldValue: this.value_,
1552
- newValue: newValue
1553
- });
1554
- }
1555
-
1556
1544
  var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);
1557
1545
 
1558
1546
  if (changed) {
1559
1547
  this.value_ = newValue;
1548
+
1549
+ if ( isSpyEnabled()) {
1550
+ spyReport({
1551
+ observableKind: "computed",
1552
+ debugObjectName: this.name_,
1553
+ object: this.scope_,
1554
+ type: "update",
1555
+ oldValue: oldValue,
1556
+ newValue: newValue
1557
+ });
1558
+ }
1560
1559
  }
1561
1560
 
1562
1561
  return changed;
@@ -2655,8 +2654,7 @@
2655
2654
  var firstTime = true;
2656
2655
  var isScheduled = false;
2657
2656
  var value;
2658
- var oldValue = undefined; // only an issue with fireImmediately
2659
-
2657
+ var oldValue;
2660
2658
  var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer["default"];
2661
2659
  var r = new Reaction(name, function () {
2662
2660
  if (firstTime || runSync) {
@@ -3329,7 +3327,7 @@
3329
3327
 
3330
3328
  cancel = function cancel() {
3331
3329
  disposer();
3332
- reject("WHEN_CANCELLED");
3330
+ reject(new Error("WHEN_CANCELLED"));
3333
3331
  };
3334
3332
  });
3335
3333
  res.cancel = cancel;
@@ -3460,7 +3458,11 @@
3460
3458
  try {
3461
3459
  var _annotations;
3462
3460
 
3463
- // Default to decorators
3461
+ if ("development" !== "production" && annotations && target[storedAnnotationsSymbol]) {
3462
+ die("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.");
3463
+ } // Default to decorators
3464
+
3465
+
3464
3466
  (_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target); // Annotate
3465
3467
 
3466
3468
  ownKeys(annotations).forEach(function (key) {
@@ -3683,9 +3685,12 @@
3683
3685
 
3684
3686
  return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));
3685
3687
  } else {
3686
- var res = this.values_.slice(index, index + deleteCount);
3687
- var oldItems = this.values_.slice(index + deleteCount);
3688
- this.values_.length = index + newItems.length - deleteCount;
3688
+ // The items removed by the splice
3689
+ var res = this.values_.slice(index, index + deleteCount); // The items that that should remain at the end of the array
3690
+
3691
+ var oldItems = this.values_.slice(index + deleteCount); // New length is the previous length + addition count - deletion count
3692
+
3693
+ this.values_.length += newItems.length - deleteCount;
3689
3694
 
3690
3695
  for (var i = 0; i < newItems.length; i++) {
3691
3696
  this.values_[index + i] = newItems[i];