@colyseus/schema 2.0.11 → 2.0.13
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/Schema.d.ts +5 -3
- package/lib/Schema.js.map +1 -1
- package/lib/types/ArraySchema.js +4 -0
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/HelperTypes.d.ts +8 -25
- package/lib/types/HelperTypes.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/Schema.ts +3 -3
- package/src/types/ArraySchema.ts +5 -0
- package/src/types/HelperTypes.ts +12 -28
- package/src/types/MapSchema.ts +7 -0
package/build/esm/index.mjs
CHANGED
|
@@ -411,6 +411,10 @@ class ArraySchema {
|
|
|
411
411
|
console.error("ArraySchema items cannot be null nor undefined; Use `deleteAt(index)` instead.");
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
|
+
// skip if the value is the same as cached.
|
|
415
|
+
if (this.$items.get(index) === value) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
414
418
|
if (value['$changes'] !== undefined) {
|
|
415
419
|
value['$changes'].setParent(this, this.$changes.root, index);
|
|
416
420
|
}
|
|
@@ -889,6 +893,11 @@ class MapSchema {
|
|
|
889
893
|
this.$changes.indexes[key] = index;
|
|
890
894
|
this.$indexes.set(index, key);
|
|
891
895
|
}
|
|
896
|
+
else if (!isRef &&
|
|
897
|
+
this.$items.get(key) === value) {
|
|
898
|
+
// if value is the same, avoid re-encoding it.
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
892
901
|
else if (isRef && // if is schema, force ADD operation if value differ from previous one.
|
|
893
902
|
this.$items.get(key) !== value) {
|
|
894
903
|
operation = OPERATION.ADD;
|