@colyseus/schema 3.0.0-alpha.16 → 3.0.0-alpha.17
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 -4
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +9 -4
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -4
- package/lib/encoder/StateView.js +9 -4
- package/lib/encoder/StateView.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/StateView.ts +10 -7
package/build/cjs/index.js
CHANGED
|
@@ -4234,12 +4234,18 @@ class StateView {
|
|
|
4234
4234
|
console.warn("StateView#add(), invalid object:", obj);
|
|
4235
4235
|
return this;
|
|
4236
4236
|
}
|
|
4237
|
+
// FIXME: ArraySchema/MapSchema does not have metadata
|
|
4238
|
+
const metadata = obj.constructor[Symbol.metadata];
|
|
4237
4239
|
let changeTree = obj[$changes];
|
|
4238
4240
|
this.items.add(changeTree);
|
|
4239
4241
|
// Add children of this ChangeTree to this view
|
|
4240
|
-
changeTree.forEachChild((change,
|
|
4241
|
-
|
|
4242
|
-
|
|
4242
|
+
changeTree.forEachChild((change, index) => {
|
|
4243
|
+
// Do not ADD children that don't have the same tag
|
|
4244
|
+
if (metadata && metadata[metadata[index]].tag !== tag) {
|
|
4245
|
+
return;
|
|
4246
|
+
}
|
|
4247
|
+
this.add(change.ref, tag);
|
|
4248
|
+
});
|
|
4243
4249
|
// add parent ChangeTree's, if they are invisible to this view
|
|
4244
4250
|
// TODO: REFACTOR addParent()
|
|
4245
4251
|
this.addParent(changeTree, tag);
|
|
@@ -4266,7 +4272,6 @@ class StateView {
|
|
|
4266
4272
|
tags = this.tags.get(changeTree);
|
|
4267
4273
|
}
|
|
4268
4274
|
tags.add(tag);
|
|
4269
|
-
// console.log("BY TAG:", tag);
|
|
4270
4275
|
// Ref: add tagged properties
|
|
4271
4276
|
metadata?.[-3]?.[tag]?.forEach((index) => {
|
|
4272
4277
|
if (changeTree.getChange(index) !== exports.OPERATION.DELETE) {
|