@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.
- package/build/cjs/index.js +9 -0
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +9 -0
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -0
- package/lib/types/ArraySchema.js +4 -0
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/MapSchema.js +5 -0
- package/lib/types/MapSchema.js.map +1 -1
- package/package.json +2 -1
- package/src/types/ArraySchema.ts +5 -0
- package/src/types/MapSchema.ts +7 -0
package/build/cjs/index.js
CHANGED
|
@@ -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;
|