@colyseus/schema 2.0.11 → 2.0.12

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.
@@ -476,6 +476,10 @@ var ArraySchema = /** @class */ (function () {
476
476
  console.error("ArraySchema items cannot be null nor undefined; Use `deleteAt(index)` instead.");
477
477
  return;
478
478
  }
479
+ // skip if the value is the same as cached.
480
+ if (this.$items.get(index) === value) {
481
+ return;
482
+ }
479
483
  if (value['$changes'] !== undefined) {
480
484
  value['$changes'].setParent(this, this.$changes.root, index);
481
485
  }
@@ -966,6 +970,11 @@ var MapSchema = /** @class */ (function () {
966
970
  this.$changes.indexes[key] = index;
967
971
  this.$indexes.set(index, key);
968
972
  }
973
+ else if (!isRef &&
974
+ this.$items.get(key) === value) {
975
+ // if value is the same, avoid re-encoding it.
976
+ return;
977
+ }
969
978
  else if (isRef && // if is schema, force ADD operation if value differ from previous one.
970
979
  this.$items.get(key) !== value) {
971
980
  operation = exports.OPERATION.ADD;