mobx-state-tree 5.0.4 → 5.0.5

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.
@@ -4667,7 +4667,7 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4667
4667
  value: function (node) {
4668
4668
  var _this = this;
4669
4669
  // the node has to use these methods rather than the original type ones
4670
- proxyNodeTypeMethods(node.type, this, "create", "is", "isMatchingSnapshotId");
4670
+ proxyNodeTypeMethods(node.type, this, "create");
4671
4671
  var oldGetSnapshot = node.getSnapshot;
4672
4672
  node.getSnapshot = function () {
4673
4673
  return _this.postProcessSnapshot(oldGetSnapshot.call(node));
@@ -4765,7 +4765,7 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4765
4765
  return false;
4766
4766
  }
4767
4767
  var processedSn = this.preProcessSnapshot(snapshot);
4768
- return ComplexType.prototype.isMatchingSnapshotId.call(this._subtype, current, processedSn);
4768
+ return this._subtype.isMatchingSnapshotId(current, processedSn);
4769
4769
  }
4770
4770
  });
4771
4771
  return SnapshotProcessor;
@@ -5759,13 +5759,17 @@ function areSame(oldNode, newValue) {
5759
5759
  if (oldNode.snapshot === newValue) {
5760
5760
  return true;
5761
5761
  }
5762
+ // Non object nodes don't get reconciled
5763
+ if (!(oldNode instanceof ObjectNode)) {
5764
+ return false;
5765
+ }
5766
+ var oldNodeType = oldNode.getReconciliationType();
5762
5767
  // new value is a snapshot with the correct identifier
5763
- return (oldNode instanceof ObjectNode &&
5764
- oldNode.identifier !== null &&
5768
+ return (oldNode.identifier !== null &&
5765
5769
  oldNode.identifierAttribute &&
5766
5770
  isPlainObject(newValue) &&
5767
- oldNode.type.is(newValue) &&
5768
- oldNode.type.isMatchingSnapshotId(oldNode, newValue));
5771
+ oldNodeType.is(newValue) &&
5772
+ oldNodeType.isMatchingSnapshotId(oldNode, newValue));
5769
5773
  }
5770
5774
  /**
5771
5775
  * Returns if a given value represents an array type.
@@ -4649,7 +4649,7 @@
4649
4649
  value: function (node) {
4650
4650
  var _this = this;
4651
4651
  // the node has to use these methods rather than the original type ones
4652
- proxyNodeTypeMethods(node.type, this, "create", "is", "isMatchingSnapshotId");
4652
+ proxyNodeTypeMethods(node.type, this, "create");
4653
4653
  var oldGetSnapshot = node.getSnapshot;
4654
4654
  node.getSnapshot = function () {
4655
4655
  return _this.postProcessSnapshot(oldGetSnapshot.call(node));
@@ -4747,7 +4747,7 @@
4747
4747
  return false;
4748
4748
  }
4749
4749
  var processedSn = this.preProcessSnapshot(snapshot);
4750
- return ComplexType.prototype.isMatchingSnapshotId.call(this._subtype, current, processedSn);
4750
+ return this._subtype.isMatchingSnapshotId(current, processedSn);
4751
4751
  }
4752
4752
  });
4753
4753
  return SnapshotProcessor;
@@ -5741,13 +5741,17 @@
5741
5741
  if (oldNode.snapshot === newValue) {
5742
5742
  return true;
5743
5743
  }
5744
+ // Non object nodes don't get reconciled
5745
+ if (!(oldNode instanceof ObjectNode)) {
5746
+ return false;
5747
+ }
5748
+ var oldNodeType = oldNode.getReconciliationType();
5744
5749
  // new value is a snapshot with the correct identifier
5745
- return (oldNode instanceof ObjectNode &&
5746
- oldNode.identifier !== null &&
5750
+ return (oldNode.identifier !== null &&
5747
5751
  oldNode.identifierAttribute &&
5748
5752
  isPlainObject(newValue) &&
5749
- oldNode.type.is(newValue) &&
5750
- oldNode.type.isMatchingSnapshotId(oldNode, newValue));
5753
+ oldNodeType.is(newValue) &&
5754
+ oldNodeType.isMatchingSnapshotId(oldNode, newValue));
5751
5755
  }
5752
5756
  /**
5753
5757
  * Returns if a given value represents an array type.